如何在动作脚本中发送http post“multipart / form-data”?

时间:2009-12-06 06:24:14

标签: actionscript-3

<form ENCTYPE="multipart/form-data"
    action="

如何在动作脚本中发送http post“multipart / form-data”?

        function PostTest():void {
            var loader : URLLoader = new URLLoader();
            var request : URLRequest = new URLRequest(foolowUp);
            var variables : URLVariables = new URLVariables();
            request.method = URLRequestMethod.POST;
            //variables.key1 = "value1";  
            //variables.key2 = "value2";  
            var sendString:String ="";
            sendString += "------------Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7";
            sendString += "Content-Disposition: form-data; name=\"name\"";
            sendString += "abcomp";
            sendString += "------------Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7--";
            request.data = sendString;
            loader.addEventListener(Event.COMPLETE, Poston_complete);
            loader.addEventListener(IOErrorEvent.IO_ERROR, Poston_error);       
            try {
                loader.load(request);
            } 
            catch (error:Error) {
            }
        }
}

POST /cgi-bin/webboard/followup3.cgi HTTP / 1.1

主持人:bbs.pramool.com

User-Agent:Mozilla / 5.0(Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5)Gecko / 20091102 Firefox / 3.5.5 GTB5(.NET CLR 3.5.30729)

接受:text / html,application / xhtml + xml,application / xml; q = 0.9, / ; q = 0.8

接受语言:en-us,en; q = 0.5

Accept-Encoding:gzip,deflate

Accept-Charset:ISO-8859-1,utf-8; q = 0.7,*; q = 0.7

Keep-Alive:100

连接:保持活力

参考者:http://bbs.pramool.com/webboard/followup.php3

Cookie:_uid1757 = 94BB51D7.6; visit_time = 211

内容类型:multipart / form-data;边界= --------------------------- 117381980119623

内容长度:1434

----------------------------- 117381980119623

内容 - 处置:表单数据;名称= “名称”

abcomp

----------------------------- 117381980119623

内容 - 处置:表单数据;名称= “密码”

036314338

----------------------------- 117381980119623

内容 - 处置:表单数据;名称= “checkkey”

----------------------------- 117381980119623

内容 - 处置:表单数据;名称= “校验和”

NERQMgpuT1

----------------------------- 117381980119623

内容 - 处置:表单数据;名称= “PIC”

1

----------------------------- 117381980119623

内容 - 处置:表单数据;名称= “身体”

----------------------------- 117381980119623

内容 - 处置:表单数据;名称= “filedesc”

----------------------------- 117381980119623

内容 - 处置:表单数据;名称= “运算符”

142

----------------------------- 117381980119623

内容 - 处置:表单数据;名称= “您做生意”

----------------------------- 117381980119623

内容 - 处置:表单数据; NAME = “pagepwd”

----------------------------- 117381980119623

内容 - 处置:表单数据;名称= “pageuser”

----------------------------- 117381980119623

内容 - 处置:表单数据; NAME = “文件”

j530492

----------------------------- 117381980119623

内容 - 处置:表单数据;名称= “ktsub”

..- ..... 15 .. 52- ..- MC - RO - ..- ...........- ..

----------------------------- 117381980119623 -

HTTP / 1.1 200确定

日期:太阳报,2009年12月6日07:29:08 GMT

服务器:Apache

TITLE:Pramool.com - 泰国最好的免费在线拍卖!

保持活跃:超时= 5,最大= 100

连接:Keep-Alive

Transfer-Encoding:chunked

Content-Type:text / html;字符集=窗户-874

1 个答案:

答案 0 :(得分:3)

检查出来:Adobe Docs

var header:URLRequestHeader = new URLRequestHeader( "enctype", "multipart/form-data" );

request.requestHeaders.push(header);