Topic: Upload Progress is Wrong

Hello,

I'm facing a problem with all runtimes when using client resize option as the progress bar is growing wrong.

Let's say I'm uploading 25 files in similiar size. The first 3-4 files moving the progress bar to 3% percent, the next 10 files move it to 15%, after 22 files we are on 50%, and the last 3 files is moving the last 50%.

There is something wrong with calculation when doing client resize.

Does anyone facing this problem ?

Cheers,

Itamar

Re: Upload Progress is Wrong

I think (and you should check this) that the percentages may be calculated based on the input size of the images - before resizing.  So if the last 3 images were reduced in size a great deal they might account for half of the 'input' size for the total of all images and thus show up in the progress as you describe.  Check the code if you want the definitive answer.

Re: Upload Progress is Wrong

I have encountered the same problem with photos being resized before upload : the percentage is calculated as total size of resized files uploaded / total size of all original (non resized) files.
I've fixed the problem with the following modifications in plupload.js (line numbers refer to the non minified 1.5.4 version, available from https://github.com/moxiecode/plupload) :

- line 895, replace 
    var events = {}, total, files = [], startTime, disabled = false;
by
    var events = {}, total, files = [], size_orig = [], startTime, disabled = false;

- line 946-947, replace 
    total.size += file.size;
    total.loaded += file.loaded;
by
    total.size += size_orig[i];
    total.loaded += file.loaded*size_orig[i]/file.size;

- after line 1086
    file = selected_files[i];
add
    size_orig[i] = file.size;

It works fine for me.