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 box,
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 gave
up on trying
to find a script to force download....

py


----- Original Message -----
From: "David Minor" <[EMAIL PROTECTED]>
To: <[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 possible.
> 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 possible
> 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