Blueimp File Upload: single file upload

itwebdeveloper picture itwebdeveloper · Jul 3, 2013 · Viewed 15.7k times · Source

I'm using Blueimp File Upload, how can I limit the upload to the last single element selected or (drag and) dropped? I already deleted the multiple attribute from input form and I set the maxNumberOfFiles option to the value 1 but if the first upload fails (because of the option maxFileSize or acceptFileTypes) the first element stays on top of the listed selected files (generated by template) and further files cannot be uploaded because they infringe the maxNumberOfFiles option. I'd desire that if an accepted file is upload and/or dropped, instead of being appended, it would replace the old (not accepted) file. I would also that the templates never prints more than one file when multiple files are dropped but only the first file.

Answer

nmz787 picture nmz787 · Sep 21, 2013

change input tag from:
<input type="file" name="files[]">
to:
<input type="file" name="file">