-1

I need to upload files whatever i browse from one html input file element. If i select a file first time using that file element and again changing that selection by picking some other file, finally i need to submit form by having that both file selection.

<html>

 <script>
     function loadFiles(){
        var form = document.getElementById("imageUploadForm");
        var file = document.getElementById("fileSelector");
        var mi = document.createElement("input");
        mi.setAttribute('type', 'file');
        mi.setAttribute('value', file.value);
        document.getElementById("imageUploadForm").innerHTML = form.innerHTML + mi;
        file.value = "";
     }
 </script>
 <form>
    <div id="imageUploadForm">
    <input type="file" onchange="loadFiles()" id="fileSelector"/>
    <input type="submit" value="Upload">
    </div>
 </form>
</html>

Thanks in advance.

2
  • What have you done so far? Show us some code, please. Commented Mar 6, 2014 at 16:44
  • Your answer is probably stackoverflow.com/questions/1593225/… Commented Mar 6, 2014 at 16:46

1 Answer 1

0

You can easily select multiple files with one input:

<input type="file" name="img" multiple>
Sign up to request clarification or add additional context in comments.

1 Comment

not sure if this is the answer on the question but if you select in multiple and realize you need to add more files like when selecting in different file location?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.