FileReference bytesLoaded - incorrect value?
Question posted by: cbellew
(Newbie)
on
April 29th, 2008 02:07 PM
Hi guys, i wonder if anyone could help me with my problem.
Basically, i am creating a file upload tool in as3. I am using a FileReference object, calling browse() and then upload(). I have an event listener catching ProgressEvent.PROGRESS Events and using ProgressEvent.bytesLoaded to update a progress bar.
The bar works fine, but i only get expected results when the swf and receiving php script are both local. I.E. on my localhost. The bar increases steadily and completes. However, when i use the swf and script on my external testing server the bar will fill immediately and bytesLoaded will be equal to bytesTotal instantly - even if the file is a few MB!).
I assume this must be something to do with php??
Any help would be much appreciated!
Thanks
Chris
P.S. Code...
Code: ( text )
var file:FileReference = new FileReference(); file.addEventListener(Event.SELECT, selectHandler); file.addEventListener(ProgressEvent.PROGRESS, progressHandler); function selectHandler(e:Event) { file.upload(new URLRequest("http://www.trancetutorials.com/testupload.php"), "image"); } function progressHandler(e:ProgressEvent):void { progressBar.width = (e.bytesLoaded / (e.bytesTotal / 100)) * 3; progressBox.text = (e.bytesLoaded / (e.bytesTotal / 100)) + "%"; } file.browse();
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Not the answer you were looking for? Post your question . . .
170,098 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).
|
|
|
Top Flash / Actionscript Forum Contributors
|