开发者

ASIFormDataRequest: POST both image/jpeg and application/xml with a

开发者 https://www.devze.com 2023-02-14 13:33 出处:网络
Given both: NSDa开发者_开发问答ta *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 reque

Given both:

NSDa开发者_开发问答ta *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?


I'm afraid that I'm not actually answering about your question.

Two facts.

  1. The ASIFormDataRequest class is not designed to support 'multipart/mixed'. (at least, currently)
  2. XML is just a plain string which can be sent via multipart/form-data too.

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 only multipart/mixed.)

If not, please think again once. Do you really need the multipart/mixed itself? 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-data instead 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消