HTTPREF
← Back to headers

HTTP Header

Content-Disposition

Response

Specifies whether content should be displayed inline or downloaded as an attachment.

HTTP header reference, syntax, examples, and developer usage.

What is the Content-Disposition header?

The Content-Disposition HTTP header is used to transmit metadata between a client and server as part of HTTP requests or responses.

HTTP headers define how content should be interpreted, cached, authenticated, secured, or processed by browsers and APIs.

Direction

This is a response header sent by the server to the client.

Syntax

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

Example

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

Common use cases

  • File downloads
  • Inline vs attachment handling
  • Custom download filenames

Common mistakes

  • Using the header in the wrong request or response context
  • Sending invalid header values
  • Incorrect header syntax
  • Assuming the header automatically changes server behaviour

Related headers