I have had success getting IE 5.5 for PC recognising the suggested 
filename by changing the content type to something other than 
application/octet-stream.  If it was left as that for IE 5.5(which the 
script snippet indicates) it would tend to take the filename of the 
script that executed it, or HTML file where the link to the script was 

        I have been using the forced download for txt and pdf files, dynamically 
generated with PHP of course, for about 2 years.  It is a pain in the ass 
to figure out the correct combinations for every different IE browser.  
Luckily it is a campus only system and the users are on PC or Linux.

Oh, and there is a bug if you try to force download in IE over an SSL 
connection WHEN USING SESSIONS.  I stumbled accross someone working on 
the SquirrelMail project who found a solution.  You just have to send 
these two extra headers to get IE force these downloads over SSL

        header('Pragma: ');
        header('Cache-Control: cache');

That one had me stumped for 2 years and I had to bail out of the sessions 
and pass everything through the URL to force a download.

Hope that helps too.

Tim Frank

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 22/08/01, 5:47:26 PM, [EMAIL PROTECTED] (Pierre-Yves) wrote regarding 
Re: [PHP] Re: force download in IE -- conclusion:

> I worked on a script like yours for a looooooooooong time now!

> I need to force the download of various type of file, doc, pdf, zip, even
> html!

> Your script works fine on Opera 5.02 and netscape 4.76 on my win NT 4.0 
> but
> not on IE 5.5 On this one, it offers me to download the script file but
> instead of being
> a php file it has now an html extension !!

> Anyhow, I do have a download by email attachment button also, because I 
> up on trying
> to find a script to force download....

> py

> ----- Original Message -----
> From: "David Minor" <[EMAIL PROTECTED]>
> Sent: Wednesday, August 22, 2001 4:10 PM
> Subject: [PHP] Re: force download in IE -- conclusion

> > I ran some tests of different header configurations of 6 browser/platform
> > combinations to find out what worked and what didn't.  I didn't cover all
> of
> > the platforms available, just those that my user-base uses, so this isn't
> > complete.
> >
> > combinations tested was IE5.5, NN4, NN6 for Windows 98 and IE5.5, NN4.7
> for
> > Mac 9.1.  I tested all of these browsers using/not using 'attachment' in
> the
> > Content-Disposition header.  and also changed out the Content-Type header
> > with 'application/octet-stream', 'application/download', and '*/*'.
> >
> > Here's the summary and what I did to make things work as well as 
> > My goal is to prompt the user with a save-as dialog for an mp3 file.
> >
> > IE5.5 for Mac always uses the quicktime plugin to play the file no matter
> > what the disposition or type is.  (also no matter what the file extension
> > is.  Couldn't figure out how to trick it to download the file.)
> >
> > IE5.5 for Win98 would attempt to download the file if
> ("content-disposition:
> > attachment; filename=....") attachment was there.
> >
> > All 3 of the Win98 browsers would do prompt with as few clicks as 
> > when content-type was "application/octet-stream".  Therefore,  I test in
> my
> > script for the Mac users and give them "Content-type:
> application/downlaod"
> > while I give other users "Content-Type: application/octet-stream".  Of
> > course, this doesn't help the IE5.5 Mac users who still have to use
> > "Downlaod Link to Disk" routine to get a save-as prompt.
> >
> > Anyone who sees different ways this could be done, please respond.
> >
> > Here's my code:
> >
> > if (eregi("mac",$HTTP_USER_AGENT))
> >    $type = "application/download";
> > else
> >    $type = "application/octet-stream";
> >
> > // stream file to user
> > header("Content-Type: $type");
> > header("Content-Disposition: attachment; filename=$filename");
> > header("Content-Length: ".filesize($tmp_file));
> > header("Content-Transfer-Encoding: binary");
> > readfile($tmp_file);
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to