Closed Bug 141627 Opened 23 years ago Closed 23 years ago

browser seems to ignore the "Content-disposition: attachment" header

Categories

(Core :: Networking: HTTP, defect)

x86
Windows 2000
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 98360

People

(Reporter: a-mikeal, Assigned: darin.moz)

References

()

Details

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.9+) Gecko/20020319 BuildID: 2002031903 I am writing a PHP application that streams files to the client and uses the "Content-disposition: attachment; filename=sample.gif" header to instruct the browser to download instread of display the file inline (see http://www.ietf.org/rfc/rfc2183.txt for a description of the expected behavior of this header). Mozilla build 2002031903 simply ignores this instruction and displays the file inline, if it sees a "Content-type: sample/type" that it recognizes. If I change the Content-type to "application/actet-stream" then the browser will initiate a download process, but it completely ignores the suggested filename "sample.gif". IE6 will behave as expected (it follows the Content-disposition header instructions) but NS6.1 also ignores it if it knows the Content-type, forcing you to send "type: application/octet-stream". Reproducible: Always Steps to Reproduce: 1. Send "Content-type: image/gif" header Send "Content-disposition: attachment; filename=sample.gif" header Send file File displays inline 2. Send "Content-type: application/octet-stream" header Send "Content-disposition: attachment; filename=sample.gif" header Send file File will download, but type if unknown
Dup of "content-disposition: attachment is ignored if known content-type specified". I'm hoping to fix it within two months or so. (And as a note, I have been unable to create a testcase in which we ignore the suggested filename... if such a testcase exists and if I could be given access to it that would be much appreciated.) *** This bug has been marked as a duplicate of 98360 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
I'm sorry I can't open the page up to you, but here's the code that caused it (suggested filename ignored, that is): <?php header ("Content-type: image/gif"); header ("Content-disposition: attachment; filename=sample.gif"); header ("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header ("Pragma: Public"); readfile ("sample.gif"); ?> That causes the browser to display it inline. If I change the Content-type to "application/octet-stream", it triggers a download, but the "Save As" dialog comes up with only the name of the file, sans extention. it shows "sample." (notice the period, but no extention) in the file name field, but in the Save as type drop-down there are only two choices: "*. " (yes, only one star), and "All Files". Neither of which will tell windows that this is a gif image (forcing the user to manually set the extention). Hope this helps, Adam
You need to log in before you can comment on or make changes to this bug.