Search code examples
javascriptjqueryjquery-upload-file-plugin

Blueimp jQuery File Upload - upload long lists problem


When I selected 100 files to upload in the [demo website][1] and then clicked on "Start upload" button some of those files start uploading and the rest of them got stuck in "Processing..."!
I have the same problem in my local version too and I have tried to find some option to keep "Start Upload" button disabled until all the files loaded correctly but I couldn't find it! does anybody know how can I handle this situation?


Solution

  • Today I found the solution, with the help of callbacks.
    First of all, I used fileuploadadd to count how many files user selected to be upload:

          'fileuploadadd' => 'function(e, data) {
                                $.each(data.files, function (index, file) {
                                  uploadListCounter++;
                                });
                                $("#upload-loading").show();
                                $("#upload-file_name-fileupload").hide()
                          }'
    

    Then in fileuploadprocessdone I checked if it processed all the selected files:

          'fileuploadprocessdone' => 'function(e, data) {
                            uploadListProcessedCounter++;
                            $("#upload-loading").text("Please wait, loading " + uploadListProcessedCounter + "/" + uploadListCounter);
                            if( uploadListProcessedCounter == uploadListCounter ) {
                              $("#upload-file_name-fileupload").show();
                              $("#upload-loading").hide();
                            }
                        }'