Answer the question
In order to leave comments, you need to log in
How to load files one by one into input file?
I have HTML code:
<form action="img.php" method='post' enctype="multipart/form-data">
<input name='file' class='file_i' type="file">
<input type="submit">
</form>
Answer the question
In order to leave comments, you need to log in
Change the field name to name="files[]"
To add the next file, make a button.
By clicking on this button, insert another type=file field with the same name into the form.
This is the basic functionality.
Then you can improve. Make the add file button visible only if the previous file is already selected, or add the next field immediately after selecting the previous one. Add the ability to delete selected files (also simply delete the corresponding field from the markup). Etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question