We help IT Professionals succeed at work.

Flash upload progress bar skips to 100%

rmirabelle
rmirabelle asked
on
1,760 Views
Last Modified: 2013-11-11
I have a flash uploader with a progress bar.  The progress bar skips immediately to 100% as soon as the file starts uploading, even if the file is large (10MB+).  How can I get the progress bar to update accurately?  I'm using AS2 with the FileReference class.  Working incorrectly in both FF and IE.
listener.onProgress = function(fr, bytes_loaded, bytes_total) {
	//update the progress bar during upload
	var percent = Math.round(bytes_loaded / bytes_total);
	t_percent.text = percent * 100;
	bar._width = max_w * percent;
};

Open in new window

Comment
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
I see that my code was wrong, but it was right before I started messing with it.  Same problem.  Uploading a 1.3MB image and the progress meter skips instantly to the end.  Another test, I uploaded a 50 MB file and was actually able to see the progress bar progress - took just under 1 second to go from 0 to 100, as though the progress that was being measured was the bytesLoaded into RAM or into the swf and not the progress of the file to the server.  

I've seen it mentioned somewhere that the server and cache settings could have some effect.  I'm running Apache 2.2.6 on Linux with PHP 5.3 and the default session cache settings.


listener.onProgress = function(fr, bytes_loaded, bytes_total) {
	//update the progress bar during upload
	var percent = Math.round(bytes_loaded / bytes_total * 100);
	t_percent.text = percent;
	m_percent._width = max_w * percent / 100;
	t_status.text = 'uploading...';
};

Open in new window

Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Commented:
The reason that Kapersky shows 100% is that when the browser uploads content, a local hook to process web traffic intercedes, much like a proxy, and the bytes sent by the file upload happens locally  (and very quickly), so Flash thinks the file is fully uploaded.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.