Question

I have the SWFUpload progress bar working on a per file basis, but I would like a progress bar for the entire queue, so you can see your overall progress. Is this possible?

Was it helpful?

Solution

Go to handlers.js file and declare two global variables. This is just the idea to start with. You need to add some other code to check UploadError and Exception to reduce remainingFiles value.

var totalFiles = 0;
var remainingFiles = 0;

Update fileDialogComplete function as follow

function fileDialogComplete(numFilesSelected, numFilesQueued) {
    try {
        if (numFilesQueued > 0) {
            totalFiles = numFilesSelected;
            remainingFiles = totalFiles;
            this.startUpload();
            $("#progressbar").css({ 'display': '' });
        }
    } catch (ex) {
        this.debug(ex);
    }
}

In uploadProgress function, add this.

function uploadProgress(file, bytesLoaded) {
     if (percent === 100) {
           var uploadedFiles = totalFiles - remainingFiles;
           var uploadprogress = (uploadedFiles / totalFiles) * 100;
           $("#progressbar").progressbar({ value: uploadprogress });
      }

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top