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

RESOLVED DUPLICATE of bug 98360

Status

()

Core
Networking: HTTP
--
major
RESOLVED DUPLICATE of bug 98360
16 years ago
16 years ago

People

(Reporter: Adam Mikeal, Assigned: Darin Fisher)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

16 years ago
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
Last Resolved: 16 years ago
Resolution: --- → DUPLICATE
(Reporter)

Comment 2

16 years ago
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.