javascript - data.context is empty on fileuploadprogress event of jQuery File Uploader -


i experiencing issues jquery file uploader (blueimp):

my implementation customized. use image previews , validation.

my problem though defining data.context in fileuploadadd event, comes in empty when fileuploadprogress fired.

$('fileinput-element').fileupload({     url: '/__module/uploadmodule/receive',     type: 'post',     acceptfiletypes: acceptedfileregex,     datatype: 'json',     'dropzone': $(dropzone),     paramname: 'files',     autoupload: false, }).on('fileuploadadd', function (e, data) {      $.each(data.files, function (index, file) {          // note: function call returns clone of element use template upload list items. works fine.         var component=uploadmodule.getdynamiccomponent('listitemcontainer');          // filling template (code omitted due better readabilty)          // appending component #uploadlist , assigning data.context         data.context = component.appendto('#uploadlist');      });      // manual submittion later on, fill array data objects each event call     datalist.push(data);  }).on('fileuploadprocessalways', function(e,data){      var index = data.index,         file = data.files[index],         node = $(data.context.children()[index]);      // further code ommitted due readability. here apply file.preview , (potential) file.error list item stored in variable node. works fine. list renders well.  }).on('fileuploadprogress', function(e, data){      // problem: data.context empty ! why???     console.log(data.context);  }); 

and how submit upon clicking start upload button:

$(datalist).each(function(){     this.submit(); });  // works - uploads being submitted , sent server. 

i have done extensive solution searching, testing, trial & error, debugging 1.5 days now. can't wrap head around this.

what doing wrong?

please note: if data.submit() right inside add event callback, data.context filled correctly when progress event fires, no longer left option of manually launching entire upload queue.

the solution problem quite surprise:

my load order fileupload component , plugins was:

jquery jquery-ui (for widget load-image.js iframe-transport.js fileupload.js fileupload-process.js fileupload-image.js fileupload-validate.js fileupload-ui.js 

and last 1 (fileupload-ui.js) pitfall. thought had include implementation of uploader, didn't. seems misunderstood for.

the moment removed it, script / implementation started working, data.context gets populated correctly.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -