how do I POST a jpeg to a web form the way a browser would?
I need to upload a file to a form. This is a generic browser based upload I want to mimic. I have looked through the HTML documentation but I can't figure out how it works.
right now I am using a URL to submit the rest of the form information "www.domain.com/form.html?field=value&field2=value2".
This is all there is to the HTML for the file upload.
<input type="file" name="Attach" />
I want to upload a jpeg so I changed the data to jpeg with this:
NSData *attach开发者_运维技巧Image;
attachImage = UIImageJPEGRepresentation(image, 90);
Now I need to send the server the image information and file name while still giving it the rest of the URL. I have found a couple of examples of people doing this to a php file but none that actually mimic how a web browser would do it.
look at classic sample:
http://www.cocoadev.com/index.pl?HTTPFileUpload
精彩评论