Building POST data manually

July 20th, 2009 – 7:50 pm
Filed as: code, iphone

After spending quite a while trying to figure this out I’m posting it as a reminder in future

POST http://example.com/upload.php HTTP/1.1
User-Agent: Photo Uploader (foobar/1.0.0)
Content-Type: multipart/form-data; boundary=AaB03x
Content-Length: xxxx 

--AaB03x
Content-Disposition: form-data; name="foo"
Content-Type: text/plain; charset=utf-8 

12345
--AaB03x
Content-Disposition: form-data; name="Filename"
Content-Type: text/plain; charset=utf-8 

image1.jpg
--AaB03x
Content-Disposition: form-data; name="MimeType"
Content-Type: text/plain; charset=utf-8 

image/jpeg
--AaB03x
Content-Disposition: form-data; name="ImageData";
filename="image1.jpg"
Content-Type: image/jpeg
Content-Transfer-Encoding: binary 


--AaB03x--

No Comments

» Leave a comment now

» RSS feed for comments on this post
» TrackBack URI

No comments yet.


Leave a Comment

  1. XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>