views:

189

answers:

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

how to send http post "multipart/form-data" in action script?

     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

Host: 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)

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

Accept-Language: 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

Connection: keep-alive

Referer: http://bbs.pramool.com/webboard/followup.php3

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

Content-Type: multipart/form-data; boundary=---------------------------117381980119623

Content-Length: 1434

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

Content-Disposition: form-data; name="name"

abcomp

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

Content-Disposition: form-data; name="password"

036314338

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

Content-Disposition: form-data; name="checkkey"

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

Content-Disposition: form-data; name="checksum"

NERQMgpuT1

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

Content-Disposition: form-data; name="pic"

1

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

Content-Disposition: form-data; name="body"

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

Content-Disposition: form-data; name="filedesc"

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

Content-Disposition: form-data; name="operator"

142

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

Content-Disposition: form-data; name="pageno"

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

Content-Disposition: form-data; name="pagepwd"

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

Content-Disposition: form-data; name="pageuser"

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

Content-Disposition: form-data; name="file"

j530492

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

Content-Disposition: form-data; name="ktsub"

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

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

HTTP/1.1 200 OK

Date: Sun, 06 Dec 2009 07:29:08 GMT

Server: Apache

TITLE: Pramool.com - The best free online auction in Thailand!

Keep-Alive: timeout=5, max=100

Connection: Keep-Alive

Transfer-Encoding: chunked

Content-Type: text/html; charset=windows-874

A: 

Check this out: Adobe Docs

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

request.requestHeaders.push(header);

Jacob Relkin
must add BOUNDARY
monkey_boys
http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
monkey_boys