As3 Urlloader Upload Progress

As3 Urlloader Upload Progress
This is the problem I faced:

in my project, I am generating a .zip file putting some byteArray objects together and I wanted to use URLLoader to upload the runtime generated file to server. The file is usually big and I needed a ProgressEvent handeler to show the uploaded bytes…

All seemed fine when I was testing it locally, but when I put it on the server I noticed that the ProgressEvent does not work for the URLLoader class and this is not a mistake by me because I later understood that this is a bug already issued in adobe bug lists.

so, I need a way around this… This is the flash code:

[code]
var variables:URLVariables = new URLVariables();
// variables includes the data for the runtime generated zip

var request:URLRequest = new URLRequest(url);
request.method = URLRequestMethod.POST;
request.data = variables;

var backVars:URLLoader = new URLLoader();
backVars.dataFormat = URLLoaderDataFormat.VARIABLES;
backVars.addEventListener(ProgressEvent.PROGRESS, onProgress);
backVars.addEventListener(Event.COMPLETE, onRespond);
backVars.load(request);

private function onProgress(e:ProgressEvent):void
{
// is never called! a bug from adobe unfortunaitly.
}
[/code]

before I post the project here, I tried some Googling and I think the best solution is to use php >> APC_UPLOAD_PROGRESS >> which is available in php 5.2.5

I found this artical here: http://www.ibm.com/developerworks/library/os-php-v525/index.html

it seems to be working fine with sending the upload progress info to JavaScript… so I thought, if it is sending the data to JS, it will be possible to send it to my flash project also, right?

This is what I want from you:

Put a simple flash file together, create some dummy byteArray in it (you may use the adobe jpg encoder to generate a jpg in the runtime and save it in a byteArray) and then try uploading the file…

Although I talked about the php solution, but you don’t have to go with that, if you have a better/easier solutions, please do feel free to go with it.

All I want is to be able to make my upload dispatch the live status of the file being uploaded.

I think the project description is so clear, so please do NOT hit the pmb with demos of your projects 🙂 I don’t have time to see them and I will ignore your whole post. just talk about how you can help me with this frustrating issue.

Thanks,
Hadi

P.S please don’t place strange high prices, I’m a programmer myself and this is something easy and fast if you know how to treat it. think posetive >> if I found you creative, I’d offer you to work with us on our software we’re putting together.

Leave a Reply

Your email address will not be published. Required fields are marked *