This is essentially a duplicate of, but since that issues relates to 4.7.x-dev I'll open a new one.
When visiting an uploaded file, the presentation in the browser depends on the storage protocol. This is especially important for PDF files as they may either be displayed in the browser or downloaded/saved/opened in a different application.
The method of specifying the desired browser action is through the Content-Disposition header which is either:
- inline, meaning showing the file in the browser, if possible; and
- attachment, meaning prompt the user to save the file.
By default, Drupal installations serve up files in two different ways, depending on the storage method:
- These files are generally served directly by the webserver without Drupal bootstrapping. Many web servers do not send any content disposition headers and so the file is generally shown inline in the browser.
- These files are served by Drupal. Drupal injects a Content-Disposition header which depends on MIME type. Currently file_inline_types (i.e. text/*, image/*, and *flash) are served as inline and remaining files are served as attachments.
- In the private://.. storage method, other MIME types, like PDFs, are sent as attachments making their behavior different than if they were stored using public://.
Looking through the history (via
git log -Sdisposition), it's clear that the Content-Disposition header was removed from the original upload module in in version 4.7.x.
In CCK FileField, the commit
commit a7da1cd39f893cdf629f9b9a2cd423f43b06c5d3 Author: Darrel O\'Pry <email@example.com> Date: Thu Feb 1 09:27:38 2007 +0000 backporting some fixes, untested... use at your own risk!!
upload_file_download() (from a version before the upload module patch) into
The list of inline mime types was made configurable in(using the variable 'filefield_inline_types').
When CCK FileField entered core (file_get_content_headers) but the logic preserved in .) this was preserved (the variable being renamed to 'file_inline_types'). The code was later split out to a separate function (
- Remove the content disposition header entirely. Is it necessary?
- Reconfigure the list of MIME types which should show up as inline. Perhaps add a configuration page, or default to a larger list of MIME types.
PASSED: [[SimpleTest]]: [MySQL] 40,111 pass(es). View
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch Content-Disposition-header-D7-1229014-25.patch. Unable to apply patch. See the log in the details link for more information. View
PASSED: [[SimpleTest]]: [MySQL] 39,650 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 48,893 pass(es). View
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch Content-Disposition-header-1229014-3.patch. Unable to apply patch. See the log in the details link for more information. View