Note that there are some explanatory texts on larger screens.

plurals
  1. POPOST multipart/form-data with ASIHTTPRequest
    text
    copied!<p>I'm new to ASIHTTPRequest and I have a problem to implement a form. At the moment I use the following code inside a UIWebForm and everything work fine.</p> <pre><code> NSString *body = @"\ &lt;html&gt; \ &lt;head&gt; \ &lt;meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"&gt; \ &lt;/head&gt; \ &lt;body&gt;\ &lt;form name=\"my_form\" action=\"http://www.server.com/ar? ca=11_s&amp;id=22630957\" \ method=\"POST\" enctype=\"multipart/form-data\"&gt; \ &lt;input type=\"text\" name=\"name\" value=\"myname\"&gt; \ &lt;input type=\"text\" name=\"email\" value=\"mym...@gmail.com\"&gt; \ &lt;textarea name=\"body\"&gt;My message&lt;/textarea&gt; \ &lt;input type=checkbox name=\"sendercc\" value=\"0\"&gt; \ &lt;input type=\"submit\" name=\"send\" value=\"Send\"&gt; \ &lt;/table&gt; \ &lt;/form&gt; \ &lt;/body&gt;\ &lt;/html&gt;"; </code></pre> <p>The (not working) code that should replace the form is the follow: </p> <pre><code> ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL: [[[NSURL alloc] initWithString:@"http://www.server.com/ar? ca=11_s&amp;id=22630957"] autorelease]]; [request setResponseEncoding:NSISOLatin1StringEncoding]; [request setPostFormat:ASIMultipartFormDataPostFormat]; [request setPostValue:@"myname" forKey:@"name"]; [request setPostValue:@"mymail@gmail.com" forKey:@"email"]; [request setPostValue:@"My message" forKey:@"body"]; [request setPostValue:@"0" forKey:@"sendercc"]; [request startSynchronous]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload