I'm working on a web uploader, however, I found something, I do not know if it's a problem. This is what I found:
When I choose files with <input type="file" multiple>
, the values of all selected files are stored in a list of files which is within the INPUT. However, when I add more files, the files that I select replace those I selected previously. I think this is a default behavior of this element DOM.
What do I have to do if I want to add more files without deleting my chosen before?
Does anyone know how to do this?
Btw: Sorry for my bad english, It's not my mother language.Thanks.
You can keep track of all
FileList
s, and loop over each one when sending through ajax: http://jsfiddle.net/46Pk8/. However, keep in mind that you can select (and upload) a file more than once this way. A better method would be to have a visual list, and let the user be able to add/remove files to/from the list.As workaround you can insert another
input
after file choose and hide original one.