jquery - Can a html5 file input remember the previous selected files? -
i'm trying create ajax multi-upload selected files within form/file-input , upload through ajax php controller. process i'm using jquery (1.11.3) , jquery-form plugin.
everything works except annoying issue; when user selects couple of files file input , proceeds select couple of files, previous selected files removed "files[]" array. following html5 file input:
<input id="multi-upload" type="file" name="files[]" multiple>
my question wether possible append newly selected files, instead of overwriting old "files[]".
i've tried solve situation creating array in javascript, push new files in array on change of file input, result receiving 'blob' error sending files directly through ajax doesn't work well, unfortunatly.
so option know of work sending form data , grabbing $_files parameter withing controller , brings me problem described above.
i guess way immediatly upload files on change of file input, people should able edit names of files , able cancel file being uploaded, far ideal.
so question is; is possible let new files appended file input instead of file input being overwritten, or there alternative method reach kind of goal?
i'm sorry if there similar question hidden somewhere, haven't been able find answer myself has been answered.
as mentioned in comment create new input every time user selects file...
jquery example:
$(document).on('change','input[type="file"][multiple]',function(){ var $this = $(this); $this.clone().insertafter($this); $this.hide(); });
you don't have use jquery of course, simplest way explain mean.
Comments
Post a Comment