gpt4 book ai didi

html - 是否有使用 "multipart/mixed"内的 "multipart/form-data"上传文件的网络浏览器?

转载 作者:太空宇宙 更新时间:2023-11-04 13:17:40 27 4
gpt4 key购买 nike

根据HTML specs :

If the contents of a file are submitted with a form, the file input should be identified by the appropriate content type (e.g., "application/octet-stream"). If multiple files are to be returned as the result of a single form entry, they should be returned as "multipart/mixed" embedded within the "multipart/form-data".

我用 <input type="file" name="files" multiple> 尝试了一个简单的 HTML 表单但是当在 Chrome 或 Firefox 中选择多个文件时,序列化形式只有每个文件的常规 MIME 部分,没有“多部分/混合”部分。

是否有网络浏览器使用“multipart/form-data”中的“multipart/mixed”上传文件,或者规范的这一部分从未在实践中实现?

更新 1:我测试了以下浏览器:

  • Chrome 34
  • 火狐 28
  • Safari 7.0.3
  • IE 11
  • 歌剧 20

更新 2:我也尝试使用 curl curl -i -F secret=42 -F files=@foo.jpg -F files=@bar.jpg http://localhost:8080/但它的行为与浏览器相同。

最佳答案

我需要知道同样的事情,所以仅供遇到此问题的其他人使用。

根据whatwg standard , 使用 multipart/form-data 的表单 should be encoded using RFC 7578 :

Encode the (now mutated) form data set using the rules described by RFC 7578, Returning Values from Forms: multipart/form-data, and return the resulting byte stream.

看看RFC 7578我们找到this :

4.3. Multiple Files for One Form Field

The form data for a form field might include multiple files.

RFC2388 suggested that multiple files for a single form field betransmitted using a nested "multipart/mixed" part. This usage isdeprecated.

To match widely deployed implementations, multiple files MUST be sentby supplying each file in a separate part but all with the same"name" parameter.

Receiving applications intended for wide applicability (e.g.,multipart/form-data parsing libraries) SHOULD also support the oldermethod of supplying multiple files.

关于html - 是否有使用 "multipart/mixed"内的 "multipart/form-data"上传文件的网络浏览器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23283099/

27 4 0
文章推荐: html - 'Loading' 消息的语义 HTML
文章推荐: java - Spring MVC JSP Form使用多个对象需要下拉列表
文章推荐: java - Mac 环境变量不可用于 java 运行时类
文章推荐: html -