Why Blueimp's JQuery File Upload add all prev. selected files even if options [replaceFileInput: false] and [maxNumberOfFiles: 1] are set on init? -


i have normal form input fields , 1 file input field. use blueimp's jquery file upload plugin upload file. seems work, if select file , after click upload button. if reselect files upload, saves prehistory of selections , after upload sends xhrs server.

i want upload 1 selected file, not selected files (in file open dialog).

here js module handle upload:

$(function () {     $('#upload_form').fileupload({          datatype: 'json',         autoupload: false,         fileinput: '#filechose_button',         replacefileinput: false,         maxnumberoffiles: 1,         multipart: true,          add: function (e, data) {              $('#upload_button').click(function () {                  $('#upload_button').attr('disabled', true);                 ...                 data.submit();                 ...             });         },          done: function (e, data) {           ... // uploaded         },          progressall: function (e, data) {           ... // update progress bar         }     }); }); 

the solutions found here (how upload file once blueimp file upload plugin?) seems not best way (i see dirty), because unbinding click event still doesn't solve problem of collecting selected files (kind of memory leaks)

the option maxnumberoffiles: 1 doesn't work me.

i had same problem, solution unbind click event of button , bind whenever add event called. try this.

...

add: function (e, data) {          $('#upload_button').unbind('click');         data.context = $('#upload_button').bind('click', function () {                     ...                     data.submit();         } } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -