Given both:
NSData *jpegData;
NSString *xmlPost:
How do I construct an ASIFormDataRequest to post both the image/jpeg data and the applicaton/xml data as a multipart/mixed POST request?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m afraid that I’m not actually answering about your question.
Two facts.
ASIFormDataRequestclass is not designed to support ‘multipart/mixed’. (at least, currently)multipart/form-datatoo.If your situation is forcing you have to use
multipart/mixed, just ignore me. (for instance, your client don’t want to modifying server program which support onlymultipart/mixed.)If not, please think again once. Do you really need the
multipart/mixeditself? No choice? Never ‘multipart/form-data’? As I know, most server part programmers like ‘multipart/form-data’ more than other rarely used format because it supported by most server frameworks. So it makes their life a lot easier 🙂If you really want another ‘regularity’ or ‘efficiency’ or some other specials instead of simplicity, you should consider other than HTTP. The only benefits of HTTP is stability and compatibility. (from it’s well-defined specification and long history) This is most important benefits, but may not suitable for you.
I didn’t try ‘multipart/mixed’. Maybe it’s possible someone has a simple way to do this.
But basically this is a kind of hacking job. (enabling feature which absent on original design) This should be painful. It’ll be easier making your own class from the HTTP specification.
I strongly recommend you to use
multipart/form-datainstead of. Which is supported on the class by design. You can assume an XML source just like a plain string. Which can be sent via plain POST field value.