Monitoring file upload progress in Actionscript 3
Posted
by helloworlder
on Stack Overflow
See other posts from Stack Overflow
or by helloworlder
Published on 2010-05-28T15:55:26Z
Indexed on
2010/05/29
7:42 UTC
Read the original article
Hit count: 198
I'm trying to track the progress of a file upload in AS3, and I'm getting strange behavior. When I select a file and upload it, the progress is instantaneously 100% even if the file is 10 or more megabytes, but it's not finished. The onComplete event is fired about 30 second to a few minutes later (depending on file size) when the file has really finished uploading. I've tested this locally and on the server, the behaviour is the same. Has anyone else experienced this? Very frustrating ...
Otherwise, the file is uploading fine. The code is simple:
myFileReference.addEventListener(ProgressEvent.PROGRESS, onUploadProgress);
function onUploadProgress(e:ProgressEvent) {
var pctDone:Number = (e.bytesLoaded / e.bytesTotal) * 100;
trace(pctDone);
}
© Stack Overflow or respective owner