Is it possible to upload two (or more) files in only one request??
I’ve been trying to do so with NSMutableURLRequest and NSURLConnection but no success so far, and I have found no convincing answers online.
It’s easy to upload a single file (using code from here) but the HTML Specs mention that when uploading more than one file you have to embed a multipart/mixed header inside the multipart/form-data, and the files to be uploaded within that multipart/mixed header.
The problem with the code linked above is that the one file that is being uploaded has it’s Content-Disposition set to “form-data” (I guess that means that the single file is “all” of the form’s data?) which I think leaves “no room” to attach another file. Please correct me if i’m wrong.
Thanks.
EDIT:
The file data you are uploading should be encoded using Base64; you can do that by means of NSData+Base64 and then use:
to send the file data, whereby I assume that
imageData1was defined as:and
imageis aUIImage.OLD ANSWER:
This is an example coming from the HTML 4.0.1 standard (very end of the document):
Notice that the files are listed all together in a multipart/mixed list.
So you can try with the code:
Take care of changing the
filenameandnameattributes and it should work.