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.P ROGRESS Events and using ProgressEvent.b ytesLoaded 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...
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.P ROGRESS Events and using ProgressEvent.b ytesLoaded 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:
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();
Comment