Use POST instead of GET for large data.

var dataStrEncoded:String=Base64.Encode(ByteLoader.data);

var XMLString:String;
XMLString = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>';
XMLString = '<file>';
XMLString += '<![CDATA[' + dataStrEncoded + ']]>';
XMLString += '</file>';

_loader = new URLLoader();
_loader.addEventListener(Event.COMPLETE,fileUploadCompleteListener);
_loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorListener);

var scriptPath:String = uploadUrl + "?key=" + _key +"&session=" + _sessionId;
var request:URLRequest = new URLRequest(scriptPath);
request.method = URLRequestMethod.POST
request.data = XMLString;
_loader.load(request);

regards,
Muzak

----- Original Message ----- 
From: "Paul Steven" <[EMAIL PROTECTED]>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Tuesday, September 11, 2007 2:57 PM
Subject: [Flashcoders] IOErrror using URLLoader with files bigger than a fewkb


>I am having problems using URLLoader to send data to a server side script.
>
> What I am doing is loading in a file as binary data and converting to Base64
> then sending this Base64 string within an xml string.
>
> It is working fine with very small files of only a few kb. However if the
> files are larger than this, I get an IOError#2032
>
> The client insists there is no problem at the server side and I cannot think
> of anything else to try my end.
>
> Is there any possibility that with larger files, the Base64.Encode operation
> has not completed before the data is sent?
>
> Here is the relevant code:
>
> var dataStrEncoded:String=Base64.Encode(ByteLoader.data);
>
> var XMLString:String;
>
> XMLString = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>';
> XMLString = '<file>';
> XMLString += '<![CDATA[' + dataStrEncoded + ']]>';
> XMLString += '</file>';
>
> var scriptPath:String = uploadUrl + "?xml=" +  XMLString  + "&key=" + _key +
> "&session=" + _sessionId;
>
> _loader = new URLLoader();
> _loader.addEventListener(Event.COMPLETE,fileUploadCompleteListener);
>
> _loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorListener);
>
>
>
> var request:URLRequest = new URLRequest(scriptPath);
> _loader.load(request);


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to