I have a form in which I use  four <input type="file" multiple> and I want to save these files in a folder and the path in database. 
But, the problem is how I came to know the number of files selected by user in each file browser?
My code is:
<form action="<%=request.getContextPath()%>/AddPhotoServlet" method="post" enctype="multipart/form-data">
                <table style="font-size: 13px;">
                    <input type="hidden" name="j_ID" value ="<%request.getParameter("jid");%>">
                    <tr>
                        <td>Photo</td> <td><input type="file" id="photo" value="photo" name="files[]" size="20" multiple="multiple" required=""></td>
                    </tr>
                    <tr>
                        <td>Deed</td> <td><input type="file" id="deed" value="deed" name="files[]" size="20" multiple="multiple"></td>
                    </tr>
                    <tr>
                        <td>Plan</td> <td><input type="file" id="plan" name="files[]"value="plan" size="20" multiple="multiple"></td>
                    </tr>
                    <tr>
                        <td>Working</td> <td><input type="file" id="working" name="files[]" value="working" size="20" multiple="multiple"></td>
                    </tr>>
                    <td colspan="6" align="center"><center><input type="submit" value="Upload" onclick="counter()">
                        </tr>
                        </table>
                        </form>
And, I also use Javascript:
<script>
            function myCounter()
            {
                var photo = document.getElementById('photo');
                alert("number of files" + photo.files.length)
                for (var i = 0; i < photo.files.length; ++i) {
                    var name = photo.files.item(i).name;
                    alert("here is a file name: " + name);
                }
            }
I get number of files by using Javascript. I want to use  photo.files.length in my Servlet.
 
    