iPhone ASIFormDataRequest具有多部分/表单数据 [英] iPhone ASIFormDataRequest with multipart/form-data

查看:130
本文介绍了iPhone ASIFormDataRequest具有多部分/表单数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如我在 ASI文档中所读的,其内容为:上载二进制数据或文件时,数据以"application/x-www-form-urlencoded"格式或"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."

那正是我的问题.我只向服务器发送一个字符串,但是服务器仅接受"multipart/form-data",而当我刚刚发送一个字符串时,ASI框架创建了一个带有"application/x-www-form-urlencoded"格式的POST请求自动,因为我没有发送任何二进制数据或文件.结果:服务器不接受我的POST请求.

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?

预先感谢您的帮助.

推荐答案

您可以手动设置格式:

[request setPostFormat:ASIMultipartFormDataPostFormat];

这篇关于iPhone ASIFormDataRequest具有多部分/表单数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆