jquery - fine uploader 3.4 and setParams -


i'm using fine uploader jquery plugin. need pass params dynamically before uploading files, so, setparams() method should job. can't have exception on onsubmit call :

1) uploader declaration

 function inituploader() {          var = $('#bsuploader').fineuploader({                       multiple: true,                       debug: true,                       request: {                           endpoint: '${request.contextpath}/quantum/uploadtos3',                           //params: {'folderid':r }                       },                       draganddrop: {                           extradropzones:[$('#filescontainer')], 

...

2) onsubmit callback

... }).on('submit', function(event, id, name) {           var r = $("#curfolderid").val();           alert(r);           up.setparams({'folderid':r}); 

3) error log

[fineuploader] caught exception in 'onsubmit' callback - object [object object] has no method 'setparams' bundle-bundle_uploader_defer.js:4 qq.log bundle-bundle_uploader_defer.js:4 qq.fineuploaderbasic.log bundle-bundle_uploader_defer.js:26 b bundle-bundle_uploader_defer.js:47 a._options.callbacks.(anonymous function) bundle-bundle_uploader_defer.js:47 qq.fineuploaderbasic._upload bundle-bundle_uploader_defer.js:43 qq.fineuploaderbasic._uploadfileorblobdatalist bundle-bundle_uploader_defer.js:43 qq.fineuploaderbasic.addfiles bundle-bundle_uploader_defer.js:29 qq.draganddrop.callbacks.dropprocessing bundle-bundle_uploader_defer.js:69 b bundle-bundle_uploader_defer.js:51 qq.uploaddropzone.ondrop bundle-bundle_uploader_defer.js:52 (anonymous function) 

any idea ?

you not using jquery plug-in wrapper correctly. documentation on plugin explains how call api methods when using plug-in. should follow readme starting the first page, , follow path outlined based on intended use. doing prevent running problems have been solved familiarizing library.

now, on fixing problem...

the up variable you've created assigned jquery object representing element id of "bsuploader". attempting call function not exist on jquery object. fine uploader not pollute jquery object additional methods. accepted/recommended standards outlined on jquery website followed when developing plug-in wrapper. means must invoke api methods within context of plug-in instance.

so, must change line:
up.setparams({'folderid':r});

to this:
up.fineuploader('setparams', {'folderid':r});

another option eliminate up variable entirely. don't need it, can call setparams in callback handlers this:
$(this).fineuploader('setparams', {'folderid':r});


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -