Ultimately what I'm trying to do is manually craft the proper POST body to send a request from a C program (well, Objective-C).
I started by examining the data sent when a user submits a web form with a file attached. I'm hoping somebody can help clear up some initial confusion I'm having:
Suppose the uploaded file is a png file. How is it encoded on client? How does the Web service know how the file was encoded so that it can successfully turn it back into image data. I have a UIImage but I'm trying to figure out how to write it to the body string so that the web server will know what that data means.
The following is some post data that I was examining. It represents a few form variables as well as a simple png file. I have verified that the server did get the request and added my photo to its database. My question is, why can I not see the actual data that represents the encoded image? It does not seem to be anywhere in this post body.
Thanks a lot for the help.
Content-Disposition: form-data; name="user"
someUser
------WebKitFormBoundaryDPIav9ZBBnDSAURS
Content-Disposition: form-data; name="description"
Description of a photo
------WebKitFormBoundaryDPIav9ZBBnDSAURS
Content-Disposition: form-data; name="photo"; filename="simple.png"
Content-Type: image/png
------WebKitFormBoundaryDPIav9ZBBnDSAURS
Content-Disposition: form-data; name="commit"
Create
------WebKitFormBoundaryDPIav9ZBBnDSAURS--