如何使用 iPhone 上传多个文件

发布于 2024-08-19 12:53:36 字数 234 浏览 6 评论 0原文

我正在将(HTTP POST)各种值发布到 posterous api。我成功上传了标题、正文和一个媒体文件,但是当我尝试添加第二个媒体文件时,我得到的服务器为 500。

它们确实允许 media 和 media[] 作为参数。

如何使用 iPhone SDK 上传多个文件?

I am posting (HTTP POST) various values to the posterous api. I am successfully able to upload the title, body, and ONE media file, but when I try to add in a second media file I get a server 500.

They do allow media and media[] as parameters.

How do I upload multiple files with the iPhone SDK?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

皇甫轩 2024-08-26 12:53:36

您得到的 500 可能基于以下两件事之一:

  • 不正确的请求
  • 服务器上的错误

现在,如果不正确,HTTP 服务器会更有用地响应 415(不支持的媒体类型)或其他内容。 500 坚持认为服务器出现问题并且您的请求有效。

您必须深入研究服务器 API 或代码(如果您编写了它),或者阅读文档并找出您的第二个请求出了什么问题……看起来您可能没有设置适当的媒体类型?

编辑:好的,所以我查看了 API。看来您发布了 XML,因此您的请求内容类型应该是

Content-Type: application/xml

API 文档没有具体说明,但这将是正确的类型。

编辑:实际上再看一遍,你只是用 URI 参数发布吗?他们的 API 文档不清楚(我也在快速查找)

The 500 your getting is probably based on one of two things:

  • An incorrect request
  • An error on the server

Now, if its an incorrect, the HTTP server would be more helpful responding back with like a 415 (unsupported media type) or something. A 500 insists that something went wrong on the server and that your request was valid.

You'll have to dig into the server API or code (if you wrote it), or read the docs and figure out what's wrong with your second request ... seems like maybe your not setting the appropriate media type?

EDIT: Ok, so I looked at the API. It appears your posting XML, so your request content-type should be

Content-Type: application/xml

The API doc didn't specifically say, but that would be the correct type.

EDIT: Actually on second glance, are you just POSTing w/URI params? Their API doc isn't clear (I'm also looking rather quickly)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文