Revision 1086219 of Content-Disposition

  • Revision slug: Web/HTTP/Headers/Cache-Disposition
  • Revision title: Cache-Disposition
  • Revision id: 1086219
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment + charset

Revision Content

{{HTTPSidebar}}

In a multipart/form-data body, the Cache-Disposition general header is a header that can be used on the subpart of a multipart body to give information about the field it applies to.

The Cache-Disposition header is defined in the larger context of MIME messages for e-mail, but only a subset of the possible parameters applies to HTTP Forms and {{HTTPMethod("POST")}} requests. Only this subset is described in

Header type {{Glossary("General header")}} (for subpart of a multipart body)
{{Glossary("Forbidden header name")}} no

Syntax

The first parameter in the HTTP context is always form-data; additional parameters are case-insensitive and have arguments, that use quoted-string syntax after the '=' sign. Multiple parameters are separated a semi-colon (';').

Content-Disposition: form-data
Content-Disposition: form-data; name="fieldName"
Content-Disposition: form-data; name="fieldName"; filename="filename.jpg"

Parameters

name
Is followed by a string containing the name of the HTML field in the form that the content of this subpart refer to. When dealing with multiple files in the same field (the {{htmlattrxref("multiple", "input")}} attribute of an {{HTMLElement("input","input type=file")}} element, there can be several subpart with the same name.
A name with a value of '_charset_' indicated that the part is not an HTML field, but the default charset to use for parts without explicit charset information.
filename
Is followed by a string containing the original name of file transmitted in the subpart. The filename is always optional and must not be used blindly by the application: path information should be striped, and conversion to the server file system rules should be done. It is mostly an indicative information.

Examples

Specifications

Specification Title
{{RFC("7578")}} Returning Values from Forms: multipart/form-data
{{RFC("2183")}} Communicating Presentation Information in Internet Messages: The Content-Disposition Header Field

Browser compatibility

{{Compat}}

See also

  •  

Revision Source

<div>{{HTTPSidebar}}</div>

<p>In a <code>multipart/form-data</code> body, the&nbsp;<strong><code>Cache-Disposition</code></strong> general header is a header that can be used on the subpart of a multipart body to give information about the field it applies to.</p>

<p>The <code>Cache-Disposition</code> header is defined in the larger context of MIME messages for e-mail, but only a subset of the possible parameters applies to HTTP Forms and {{HTTPMethod("POST")}} requests. Only this subset is described in</p>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">Header type</th>
   <td>{{Glossary("General header")}} (for subpart of a multipart body)</td>
  </tr>
  <tr>
   <th scope="row">{{Glossary("Forbidden header name")}}</th>
   <td>no</td>
  </tr>
 </tbody>
</table>

<h2 id="Syntax">Syntax</h2>

<p>The first parameter in the HTTP context is always <code>form-data</code>; additional parameters are case-insensitive and have arguments, that use quoted-string syntax after the <code>'='</code> sign. Multiple parameters are separated a semi-colon (<code>';'</code>).</p>

<pre>
Content-Disposition: form-data
Content-Disposition: form-data; name="fieldName"
Content-Disposition: form-data; name="fieldName"; filename="filename.jpg"</pre>

<h2 id="Parameters">Parameters</h2>

<dl>
 <dt><code>name</code></dt>
 <dd>Is followed by a string containing the name of the HTML field in the form that the content of this subpart refer to. When dealing with multiple files in the same field (the {{htmlattrxref("multiple", "input")}} attribute of an {{HTMLElement("input","input type=file")}} element, there can be several subpart with the same name.<br />
 A <code>name</code> with a value of <code>'_charset_'</code> indicated that the part is not an HTML field, but the default charset to use for parts without explicit charset information.</dd>
 <dt><code>filename</code></dt>
 <dd>Is followed by a string containing the original name of file transmitted in the subpart. The filename is always optional and must not be used blindly by the application: path information should be striped, and conversion to the server file system rules should be done. It is mostly an indicative information.</dd>
</dl>

<h2 id="Examples">Examples</h2>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Title</th>
  </tr>
  <tr>
   <td>{{RFC("7578")}}</td>
   <td>Returning Values from Forms: multipart/form-data</td>
  </tr>
  <tr>
   <td>{{RFC("2183")}}</td>
   <td>Communicating Presentation Information in Internet Messages: The Content-Disposition Header Field</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p class="hidden">To contribute to this compatibility data, please write a pull request against this file: <a href="https://github.com/mdn/browser-compat-data/blob/master/http/headers.json">https://github.com/mdn/browser-compat-data/blob/master/http/headers.json</a>.</p>

<p>{{Compat}}</p>

<h2 id="See_also">See also</h2>

<ul>
 <li>&nbsp;</li>
</ul>
Revert to this revision