13

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.

DontVoteMeDown
  • 21,122
  • 10
  • 69
  • 105
itwebdeveloper
  • 699
  • 1
  • 7
  • 15
  • are you using the UI version or the basis plugin? show us your code! – Dirty-flow Jul 04 '13 at 07:47
  • I'm using the Basic Plus UI plugin. It is the standard plugin code less multiple property in input tag as stated in the [plugin FAQ] (https://github.com/blueimp/jQuery-File-Upload/wiki/Frequently-Asked-Questions) – itwebdeveloper Jul 04 '13 at 12:02
  • Did you resolve this issue? If so, please help! Thanks! – laviku Feb 28 '14 at 17:14

3 Answers3

11

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

nmz787
  • 1,960
  • 1
  • 21
  • 35
5

Remove files array and remove multiple attribute:

<input id="fileupload" type="file" name="files[]" multiple>

to:

<input id="fileupload" type="file" name="file">
ptCoder
  • 2,229
  • 3
  • 24
  • 38
3

Also change the multiple attribute if it is set from

<input type="file" multiple="" name="file">

to:

<input type="file" name="file">
Steve C
  • 2,638
  • 3
  • 25
  • 27