I'm trying to create an AJAX Multi-Upload which will get all selected files within a form/file-input and upload this through my AJAX PHP Controller. For this process I'm using jQuery (1.11.3) and the jQuery-Form plugin.
Everything works properly except a really annoying issue; When a user selects a couple of files with the file input and then proceeds to select another couple of files, the previous selected files are removed from the "files[]" Array. Following is my HTML5 file input:
<input id="multi-upload" type="file" name="files[]" multiple> My question is basically wether it is possible to just append the newly selected files, instead of overwriting the old "files[]".
I've tried to solve this situation by creating an Array in my JavaScript, which will push the new files in the array on change of the file input, but this will just result into receiving a 'blob' error as sending files directly through AJAX doesn't really work too well, unfortunatly.
So the only option that I know of that could work is by sending the form data and grabbing the $_FILES parameter withing my Controller and this brings me back to the problem described above.
I guess a way would be to immediatly upload the files on change of the file input, but as people should be able to edit names of their files and be able to cancel the file from being uploaded, this is far from ideal.
So my question is; Is it possible to let new files be appended to the file input instead of the file input being completely overwritten, or is there an alternative method to reach this kind of goal?
I'm sorry if there is a similar question hidden somewhere, but I haven't been able to find any answer myself that has been properly answered.