UPLOAD_COMPLETE_DATA - return size limit?
I'm doing an image upload that returns a large chunk of data - I'm base64-encoding the uploaded image and returning it immediately within an XML document. This data is retrieved via the UPLOAD_COMPLETE_DATA handler.
On my Windows machine, the data comes back perfectly. On my Mac, however, only a small piece is returned. If the file that I upload is more than a few kilobytes in size, only a truncated version of the data is returned (exactly 2,634 bytes each time). This leads me to believe that there is a limit (at least on the Mac version of the Flash player) to the amount of data that can be returned this way. Anyone else experienced this issue?
And yes, I've tested the backend thoroughly, the entire image is being uploaded correctly - I can save it to the server, I've even created text files of the output on the server just to make sure the right info is being sent back.
I've completely simplified my code for testing. There are two buttons (browse and upload) and a textarea to view the output.
PHP Code:
var fr:FileReference = new FileReference();
browse_btn.addEventListener(MouseEvent.CLICK,doBrowse);
upload_btn.addEventListener(MouseEvent.CLICK,doUpload);
function doBrowse(e:Event):void{ fr.browse(); }
function doUpload(e:Event):void
{
var URLreq:URLRequest = new URLRequest("scriptnamehere.php");
fr.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,uploadSuccess);
fr.upload(URLreq);
}
function uploadSuccess(e:DataEvent):void{
debug_textarea.text += e.data;
}
Any feedback would be appreciated.
http response cut on upload_complete_data / air
Dear all,
I can fully confirm your problem: I'm also doing a file upload using file.upload(urlrequest), and catch the server response via the upload_complete_data event.
My response is a relatively big (>1.5kb) XML response, which occasionally just ends being returned.
I then catched the network traffic using wireshark, which clearly showed that the response itself is sent by the server and received on the client completely, but the event.data property of the upload_complete_data event just didn't get it (or, well, partly).
What makes it more strange is that this does only happen occasionally. Even when uploading the same file twice, it may be that it works the first time, but fails on the second time (or vice versa).
For me this really seems as a flash/air problem, and yes, I'm also using the mac version.
so if anyone has an idea what this could be (beside a bug ;-) ), please let us know.
thanks
alex