使用Adobe Air中的HTTPService类设置HTTP正文

时间:2012-03-02 07:29:55

标签: flex air flex4 flex3

我需要使用Adobe Air API中的HTTPService类将数据的字节数组作为HTTP正文发送。任何人都可以建议我这样做吗?

1 个答案:

答案 0 :(得分:0)

试试这个

var encodedString : String = Base64.encode( imageByteArray );  
var service : HTTPService = new HTTPService();
service.method = "POST";  
service.contentType = 'application/x-www-form-urlencoded';  
service.url = 'http://www.mydomain.com/upload.php';         
var variables : URLVariables = new URLVariables();      
variables.imageArray = encodedString;  
variables.variable2 = "some text string";  
variables.variable3 = "some more text";             
service.send( variables );

Base64类来自于 http://code.google.com/p/jpauclair-blog/source/browse/trunk/Experiment/Base64/src/Base64.as