Archive for July, 2009

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–

addthis_url = ‘http%3A%2F%2Fwww.c3b.co.uk%2F%3Fp%3D70′;
[...]