边界在多部分发布请求中如何工作?
我尝试将文件从 iPhone 上传到服务器。我试图避免使用任何非苹果制作的库,据我所知,我需要在构建我的请求时达到相当低的水平。有人可以告诉我多部分/表单数据请求中的“边界”是什么以及如何正确使用它吗?
I trying to upload a file from an iPhone to a server. I'm trying to avoid using any libraries that aren't made by apple, and from what I can tell it looks like I'll need to go pretty low level on constructing my request. Can someone tell me what the "boundary" is in a multipart/form-data request and how to use it properly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
边界是任意一段文本,客户端使用它来分隔所发布的表单的字段。客户端声明其使用的边界作为
Content-type
标头的一部分。来自 IETF HTML 中基于表单的文件上传 RFC:
在第一个示例中,边界是固定字符串
AaB03x
。在第二个示例中,边界首先是AaB03x
,然后切换到BbC04y
。The boundary is an arbitrary piece of text which the client uses to delimit the fields of the form being posted. The client declares the boundary it is using as part of the
Content-type
header.From the IETF Form-based File Upload in HTML RFC:
In the first example, the boundary is the fixed string
AaB03x
. In the second example, the boundary is firstAaB03x
and then switches toBbC04y
.