Content-Disposition

The HTTP Content-Disposition response header indicates whether content is displayed inline in the browser or handled as a downloadable attachment.

Usage

In a standard HTTP response, the Content-Disposition header controls how the browser presents content to the user. Setting the value to inline tells the browser to render the content directly. Setting the value to attachment triggers a download dialog instead.

This header also plays a role in multipart/form-data responses and form submissions. Each part of a multipart body includes its own Content-Disposition field, identifying the form field name and optional filename for uploaded files. The part boundary is defined in the Content-Type header.

Directives

inline

The inline directive instructs the browser to display the content directly within the page. This is the default behavior for most responses when Content-Disposition is absent.

attachment

The attachment directive triggers a download prompt. The browser presents a "Save As" dialog rather than rendering the content in the viewport.

filename

The filename parameter suggests a default filename for the downloaded file. The value is enclosed in double quotes and follows ASCII encoding rules.

Content-Disposition: attachment; filename="report.pdf"

filename*

The filename* parameter extends filename with support for character encoding beyond ASCII. When both filename and filename* are present, filename* takes priority. This is useful for filenames containing non-ASCII characters.

Content-Disposition: attachment; filename="document.pdf"; filename*=UTF-8''d%C3%B6cument.pdf

form-data

The form-data directive appears in multipart body parts and identifies the content as belonging to a form submission.

name

The name parameter is required within multipart body parts and identifies the form field the part corresponds to.

Example

A server responding with a CSV file download sets attachment and provides a suggested filename. The browser opens a save dialog with "export.csv" pre-filled.

Content-Disposition: attachment; filename="export.csv"

A server displaying a PDF directly in the browser uses inline. The browser renders the PDF in its built-in viewer rather than downloading the file.

Content-Disposition: inline

In a multipart form submission, each part carries its own Content-Disposition field. The name parameter maps the part to the corresponding form field, and filename indicates the original name of an uploaded file.

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

Takeaway

The Content-Disposition header controls whether a browser displays content inline or triggers a file download, and provides filename metadata for both attachments and multipart form submissions.

See also

Last updated: March 11, 2026