开发者

send image to server in multipart iphone

开发者 https://www.devze.com 2023-02-24 07:43 出处:网络
I want to send an image to the server as a multip开发者_运维知识库art data. The data must be concated at the header part and not at the body part

I want to send an image to the server as a multip开发者_运维知识库art data.

The data must be concated at the header part and not at the body part and the Content-Disposition: part must be left blank.

Any code is really appreaciated. Thanks in advance

For example

NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary];
[request addValue:contentType forHTTPHeaderField: @"Content-Type"];

I want to append the data in the content type. How it can be done like for boundary there is boundary=%@ so for concating the data what keyword mus be used? _=%@.?


Take a look at how TTURLRequest does it here:

http://google.com/codesearch/p?hl=en#paiB7gGbH1E/trunk/Projects/three20/src/TTURLRequest.m&q=TTURLRequest.m%20multipart&sa=N&cd=1&ct=rc

Or how ASIHTTPRequest does it here:

http://google.com/codesearch/p?hl=en#puVSP9AmSPI/Classes/ASIFormDataRequest.m&q=ASIHTTPRequest.m%20multipart&sa=N&cd=2&ct=rc

Better yet, use one of those two libraries to handle the multipart post for you.

0

精彩评论

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