iPhone ASIFormDataRequest with multipart/form

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 accept my POST request.

How could I solve this problem?

Thanks in advance for helping.


您可以手动设置格式:

[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!

链接地址: http://www.djcxy.com/p/3774.html

上一篇: 文件名中的国际字符以多部分形式提供

下一篇: 带有multipart / form的iPhone ASIFormDataRequest