Tuesday, 3 September 2013

FineUploader Progressbar questions

FineUploader Progressbar questions

I'm a bit confused about using the progress event in v3.8 (using the
jQuery wrapper) I understand that only certain browsers that support
ProgressEvent interface, so I'm testing this in Firefox v20.0.1.
Using some of another's code, I've added this:
.on('progress', function (id, filename, uploadedBytes, totalBytes)
{
alert('uploadedBytes: ' + uploadedBytes + '\n totalBytes: ' +
totalBytes);
if (uploadedBytes < totalBytes) {
progress = '"' + fileName + '" uploading... ' +
Math.round(uploadedBytes / totalBytes*100) +'%';
$('#qq-progress-bar').html(progress);
}
else {
$('#qq-progress-bar').html('saving');
}
})
Please look at the ALERT function within this event, above. If the input
parameters of the method are correct, I shouldn't see the name of the
uploaded file displayed in the 'uploadedBytes' parameter. The totalBytes
parameter appears to be correct. The alert is displayed below:

I can visibly see the progress bar in certain browsers, such as FireFox
v20.0.1 but the bar doesn't progress. Also, the % value of the amount
uploaded doesn't really do much. I'll see a single value, and then it'll
be complete.
To get all this to appear I'm changing the 'qq-progress-bar' as named in
the file template. Am I going about this wrong or making this more
complicated than I need to? I just need to show progress, and a text value
isn't required but certainly is nice. Examples? Thoughts?
Thanks!

No comments:

Post a Comment