Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
112
rated 0 times [  115] [ 3]  / answers: 1 / hits: 135390  / 11 Years ago, sat, june 8, 2013, 12:00:00

I am using dropzone.js for my drag-drop file upload solution. I am stuck at something where I need to call a function after all the files are uploaded. In this case,



Dropzone.options.filedrop = {
maxFilesize: 4096,
init: function () {
this.on(complete, function (file) {
doSomething();
});
}
};


doSomething() will be called for each file that has been uploaded. How can I call a function after all the files are uploaded?


More From » jquery

 Answers
96

EDIT: There is now a queuecomplete event that you can use for exactly that purpose.






Previous answer:



Paul B.'s answer works, but an easier way to do so, is by checking if there are still files in the queue or uploading whenever a file completes. This way you don't have to keep track of the files yourself:



Dropzone.options.filedrop = {
init: function () {
this.on(complete, function (file) {
if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
doSomething();
}
});
}
};

[#77742] Friday, June 7, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aden

Total Points: 369
Total Questions: 100
Total Answers: 83

Location: Australia
Member since Tue, Oct 19, 2021
3 Years ago
;