There is some lovely code in file_file_download that determines what a file object's headers should be on download. If it's an image or text, it sets the content-disposition to inline; if it's a PDF or something, it sets it to force a download. It also sets the content type and length correctly. Unfortunately, all this lovely code is buried inline, inside of file_file_download(), where contrib can't reuse it. Patch forthcoming.

CommentFileSizeAuthor
#1 943112-1-file-headers.patch2.3 KBksenzee
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ksenzee’s picture

Status: Active » Needs review
FileSize
2.3 KB
Stevel’s picture

Status: Needs review » Reviewed & tested by the community

This is working good.

No API change here, only an API addition.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.