I have such html code
<input name="childLogin" type="text" placeholder="Login" id="login"/>
    <p class="validation" id="loginVal"></p>
    <input name="childPassword" type="password" placeholder="Password" id="password"/>
    <p class="validation" id="passVal"></p>
    <input name="childName" type="text" placeholder="Full name" id="fullName"/>
    <p class="validation" id="nameVal"></p>
    <p> Gender <select id="gender" name="gender">
        <option>
            Male
        </option>
        <option>
            Female
        </option>
    </select></p>
    <p>Select photo <input type="file" id="photo" name="photo" style="width:200px;border: none"/></p>
    <button  id="button">Add</button>
And some javascript code
document.getElementById("button").onclick = function () {
        var image = document.getElementById('photo').value;
        var gender = document.getElementById('gender').value;
       var log = document.getElementById('login').value;
      var password = document.getElementById('password').value;
       var fullName = document.getElementById('fullName').value;
  $.ajax({
                method: "post",
                url: "http://localhost:8080/servlets.AddChildServlet",
                data: {login: log, password: password, fullName: fullName, gender: gender, image: image}
            })
                    .done(function (msg) {
                        alert(image);
                    });
How can I pass the image file to the servlet? And what should I write in my servlet to retrieve the image as inputStream?
 
    