【问题标题】:Set HTTP body using HTTPService class in the Adobe Air在 Adob​​e Air 中使用 HTTPService 类设置 HTTP 正文
【发布时间】:2012-03-02 07:29:54
【问题描述】:

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

【问题讨论】:

    标签: apache-flex air flex4 flex3


    【解决方案1】:

    试试这个

    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

    【讨论】:

      猜你喜欢
      • 2010-10-04
      • 2014-03-24
      • 1970-01-01
      • 2011-09-27
      • 2012-03-25
      • 2010-09-25
      • 1970-01-01
      • 2014-04-08
      相关资源
      最近更新 更多