Table of Contents

What is the Content-Disposition Header? (HTTP Save as, Email Attachment)

About

content-disposition is a:

that indicates to the user-agent (ie browser or email client) if the content (resource/body):

Example

Php: How to indicate to the browser if the request should be downloaded

if ($download) {
  header('Content-Disposition: attachment;' . rfc2231_encode('filename', \dokuwiki\Utf8\PhpString::basename($orig)) . ';');
} else {
  header('Content-Disposition: inline;' . rfc2231_encode('filename', \dokuwiki\Utf8\PhpString::basename($orig)) . ';');
}

Email Attachment

The body of an email may be directly the attachment.

Example:

Content-Disposition: attachment; filename="images.zip"