django - Jquery File upload: How to set Multiple File Upload Widgets? -


i'm using jquery file upload plugin django backend. worked until tried integrate multiple file upload widgets on same page.

first problem

first, i'm not sure i'm supposed change inspite of doc. here original main.js file mentioned in page. i'm not jquery expert , can't understand here precisely need change.

i'd happy see example of main.js rewritten should be.

second problem

the whole purpose of having multiple widgets on 1 page me, display different elements. that's why, in backend, upload/view/ url became upload/view/(?p<pk>\d+)/.

for example, if in 1 page want displays 2 photos albums containing many photos, expect page call upload/view/1 , upload/view/2

the backend part works since calling there urls return correct json answer.

but ajax part, don't know do. in main.js file, can see should changed, don't know how it:

            $.ajax({             // uncomment following send cross-domain cookies:             //xhrfields: {withcredentials: true},             //url: $('#fileupload').fileupload('option', 'url'),             url: '/upload/view/',             datatype: 'json',             context: $('#fileupload')[0] 

any appreciated. thanks.

you need comment or delete these part of code:

// initialize jquery file upload widget: $('#fileupload').fileupload({     // uncomment following send cross-domain cookies:     //xhrfields: {withcredentials: true},     //url: 'server/php/' });  // enable iframe cross-domain access via redirect option: $('#fileupload').fileupload(     'option',     'redirect',     window.location.href.replace(         /\/[^\/]*$/,         '/cors/result.html?%s'     ) ); 

and put lines, allow set multiple upload widgets based on fileupload class:

$('.fileupload').each(function () {   $(this).fileupload({     dropzone: $(this)   }); }); 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -