4.2. 每个部分的 Content-Disposition 头字段
4.2. Content-Disposition Header Field for Each Part
🇬🇧 英文原文
Each part MUST contain a Content-Disposition header field [RFC2183] where the disposition type is "form-data". The Content-Disposition header field MUST also contain an additional parameter of "name"; the value of the "name" parameter is the original field name from the form.
For example, a part might contain a header field such as:
Content-Disposition: form-data; name="user"
For form data that represents the content of a file, a name for the file SHOULD be supplied as well, by using a "filename" parameter of the Content-Disposition header field. The file name is not mandatory for cases where the file name is not available or is meaningless or private; this might result, for example, when selection or drag-and-drop is used or when the form data content is streamed directly from a device.
If a "filename" parameter is supplied, the requirements of [RFC2183] Section 2.3 with respect to the receiving user agent's processing of that parameter apply. In particular, the file name should be treated as advisory; when possible, the receiver SHOULD accommodate the sender's supplied file name, but receivers are cautioned that such accommodation might result in unexpected or dangerous behavior (see Section 7).
🇨🇳 中文翻译
每个部分必须 (MUST) 包含一个 Content-Disposition 头字段 [RFC2183],其中处置类型为 "form-data"。Content-Disposition 头字段还必须 (MUST) 包含一个附加参数 "name"; "name" 参数的值是表单中原始的字段名称。
例如,一个部分可能包含这样的头字段:
Content-Disposition: form-data; name="user"
对于表示文件内容的表单数据,还应该 (SHOULD) 通过使用 Content-Disposition 头字段的 "filename" 参数来提供文件的名称。在文件名不可用或无意义或私有的情况下,文件名不是强制性的; 例如,当使用选择或拖放时,或者当表单数据内容直接从设备流式传输时,可能会出现这种情况。
如果提供了 "filename" 参数,[RFC2183] 第 2.3 节关于接收用户代理对该参数的处理的要求适用。特别是,文件名应该被视为建议性的; 在可能的情况下,接收方应该 (SHOULD) 适应发送方提供的文件名,但接收方要谨慎,因为这种适应可能导致意外或危险的行为(参见第 7 节)。