multiple file input html not working
<p>I have the following code for multiple file input </p>

<pre><code>&lt;form action="" enctype = "multipart/form-data" method="post" name="login"&gt;

&lt;input type = "file" name = "photo[]" id = "files" multiple onchange =  "handleFileSelect(this.files)"/&gt;&lt;br/&gt;
&lt;div id="selectedFiles"&gt;&lt;/div&gt;
&lt;input type="submit" value="Sign In"&gt;
&lt;/form&gt;
</code></pre>

<p>The javascript equivalent function is.</p>

<pre><code>selDiv = document.querySelector("#selectedFiles");
function handleFileSelect(e) {
    if(!this.files) return;

    selDiv.innerHTML = "";

    var files = e;
    for(var i=0; i&lt;files.length; i++) {
        var f = files[i];
        selDiv.innerHTML += f.name + "&lt;br/&gt;";

    }

}
</code></pre>

<p>What I am getting is upon uploading the second file. The FileList gets overwritten and instead of having 2 files, second file is present in the FileList. Here FileList is passed by this.files.</p>

<p>Also upon passing to the server only second image is passed. I have googled throughly but could not find answer. I would appreciate if anyone could help.</p>