I would appreciate if anyone can take a look at this code and let me know if
I am on the right tracks. Basically I am uploading a file to a server by
converting the binary data to Base64 and sending this as xml data.

I am getting an error from the server saying file type is not supported so I
am wondering if my code is correct especially the bit that creates the xml
data to send.

Thanks in advance


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

var XMLString:String;                   
                        
XMLString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
XMLString += "<file>";
XMLString += "<![CDATA[" + dataStrEncoded + "]]>";
XMLString += dataStrEncoded;                    
XMLString += "</file>";
                        
loader = new URLLoader();                       
loader.addEventListener(Event.COMPLETE, xmlLoaded);

var request:URLRequest = new URLRequest(ScriptPath);
            
request.method = URLRequestMethod.POST;
            
var variables:URLVariables = new URLVariables()
variables.xml = XMLString;
        
request.data = variables

loader.load(request);

_______________________________________________
[email protected]
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