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]

Reply via email to