2
Vote

Allow inline content-dispositions for FileResults

description

Currently, the FileResult class and its descendants are hard-coded to use an "attachment" content-disposition. In most web browsers, it has the effect of prompting the user with a file download window.

"Inline" content-dispositions are not supported, which is an important use-case for images. Consider an image resource for a photo gallery application that links to the image. The inline content-disposition is needed to display the image in the browser, rather than prompting the user to save it to disk immediately.

comments

levib wrote Jun 25, 2012 at 4:28 PM

Specifying a FileDownloadName implies that the developer had intended for the client to download the file, and it is this property which triggers the Content-Disposition: attachment header to be generated. If you do not specify a FileDownloadName, no Content-Disposition header is generated, which will cause the image to be displayed inline.

ShadowChaser wrote Jun 25, 2012 at 7:00 PM

Interesting point about the FileDownloadName and how it applies to the attachment header.

It's still limiting however - there's still a use case to be able to control the name of the file when the user rights clicks on the inline image to save it to disk. (ie/ to avoid "Untitled.png", etc)