多文件的多部分HTTP请求应该是什么样的? [英] What should a Multipart HTTP request with multiple files look like?

查看:173
本文介绍了多文件的多部分HTTP请求应该是什么样的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个iPhone应用程序,使多个HTTP请求与多个图像文件。

I'm working on an iPhone app that makes a multipart HTTP request with multiple image files.

看起来像在服务器端发生了什么,其中一个图像被正确解析,但其他两个文件不是。

It looks like what's happening, on the server side, is that one of the images is getting parsed properly, but the other two files are not.

任何人可以发布包含多个图像文件的示例HTTP多部分请求?

Can anybody post a sample HTTP multipart request that contains multiple image files?

推荐答案

嗯,请注意,请求包含二进制数据,所以我不会发布请求,而是将每个不可打印的ascii字符转换成一个点(。)。

Well, note that the request contains binary data, so I'm not posting the request as such - instead, I've converted every non-printable-ascii character into a dot (".").

POST /cgi-bin/qtest HTTP/1.1
Host: aram
User-Agent: Mozilla/5.0 Gecko/2009042316 Firefox/3.0.10
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://aram/~martind/banner.htm
Content-Type: multipart/form-data; boundary=----------287032381131322
Content-Length: 514

------------287032381131322
Content-Disposition: form-data; name="datafile1"; filename="r.gif"
Content-Type: image/gif

GIF87a.............,...........D..;
------------287032381131322
Content-Disposition: form-data; name="datafile2"; filename="g.gif"
Content-Type: image/gif

GIF87a.............,...........D..;
------------287032381131322
Content-Disposition: form-data; name="datafile3"; filename="b.gif"
Content-Type: image/gif

GIF87a.............,...........D..;
------------287032381131322--

请注意每行(包括以322--结尾的最后一行)由\r\\\
序列终止。

Note that every line (including the last one that ends with "322--") is terminated by a \r\n sequence.

这篇关于多文件的多部分HTTP请求应该是什么样的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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