views:

151

answers:

2

I created an image uploader for an app I am working on. I first used php for the server side script, and everything worked fine. I found out afterwards I had to use .net, so I created new serverside scripts. The problem I am having is that my event.COMPLETE listener is never firing. I can receive data back using a DATAEVENT listener, but then it stops at this error:

Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.

Here is how I am sending my file.

var fileRefReq:URLRequest = new URLRequest(FILE_UPLOAD_TEMP);
                var fileReqVars:URLVariables = new URLVariables();
                fileReqVars.subdir = "Temp";
                fileRefReq.data = fileReqVars;
                fileRefReq.method = URLRequestMethod.POST;
                fileRef.upload(fileRefReq);

The file definitely gets uploaded to the first TEMP directory, but then it breaks with the above error.

Has anyone else had a similar problem or point me in the right direction for solving this?

A: 

This is an error produced by Flash. The most common causes are:

  1. It could be a 404 Error you are getting somewhere in the Flash.

  2. This error can occur if you close the browser while it is loading something.

  3. By default, the calling SWF file and the URL you load must be in the same domain. For example, a SWF file at www.adobe.com can load data only from sources that are also at www.adobe.com. To load data from a different domain, place a URL policy file on the server hosting the data.

Number 3 is important because a common user problem with Flash is security issues - so it is just something to rule out. Most likely not the cause here.

I would test for these 3 causes and read over the URLRequest: http://livedocs.adobe.com/flex/3/langref/flash/net/URLRequest.html

After some additional thought I think it is timing out but that is just a theory. Add an event listener like so:

urlLoader.addEventListener("httpResponseStatus", function(event:HTTPStatusEvent):void

to see what is actually happening.

Todd Moses
would problem #3 also be a problem if loading files across a network? Also, why would it upload the file, but still give me an error if this were a problem?
pfunc
A: 

You have to handle the event such as:

// add the event listener
urlLoader.addEventListener( IOErrorEvent.IO_ERROR, onErrorHandler );

// handle the error event like this:
private function onErrorHandler( e: IOErrorEvent ): void {
 trace( "An io error occurred." );
}

Hope that helps

Gary Paluk
well i found out that the file was uploading correctly, that the dataevent was being called when completed, but for some reason it still tells me that the upload failed. So everything is working, I'm getting a response, but still getting an error.
pfunc