开发者

iPhone ASIFormDataRequest with multipart/form-data

as I have read in the ASI Documentation, its writen: "Data is posted in 'application/x-www-form-urlencoded' format, or 'multipart/form-data' format when uploading binary data or files."

That's exactly my Problem. I am sending just a String to a server, but the server just accepts 'multipart/form-data' and as I just send a String, the ASI Framework creates a POST request with 'application/x-www-form-urlencoded' format automatically, cause I am not sending any binary data or file. Result: the server does not acce开发者_StackOverflow中文版pt my POST request.

How could I solve this problem?

Thanks in advance for helping.


You could set the format manually:

[request setPostFormat:ASIMultipartFormDataPostFormat];


I've just solved this problem in a very ugly way: I've changed the ASIFormDataRequest implementation on line 200:

if ([self postFormat] == ASIURLEncodedPostFormat) {
    [self buildMultipartFormDataPostBody];  //NEW LINE  
    //[self buildURLEncodedPostBody];  ORIGINAL LINE
} else {
    [self buildMultipartFormDataPostBody];
}

I would be glad to hear any other suggestion!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜