headers different for IE on Macs?
Posted: Fri Aug 16, 2002 3:00 pm
The following code fairly well filters for a request to either download a file by clicking on a link, or open that file with a helper application lik PDFs and Acrobat.
And it works pretty good for IE and Mozilla or NS 6.2 for the exceiption of Mozilla & NS trying to save a downloaded file as 'filename.mp3.exe'...still haven't been able to correct that.
I am also experiencing some difficulties with Macintosh IE 5.2 which when trying to download the file tries to save it as 'index.php' instead of the filename.mp3.
I imagine I would have to to an additional check if the platform is mac, but I have no idea which headers would properly start a download to save the file to the mac filesystem with the correct name because I don't have a mac to test on. If anyone has any experience with macs and headers, or just a lot of experience with headers
would be great.
Code: Select all
##Downloading
$browser_type = getenv("HTTP_USER_AGENT");
$query="select * from files where file_id = "$file_id"";
$result=mysql_query($query);
$assoc = mysql_fetch_assoc($result);
if (preg_match("/compatible; MSIE/i", "$browser_type")){
header("Content-type: application/octetstream");
header("Content-Disposition: attachment; filename="".$assocї"name"].""");
}
else{
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename="".$assocї"name"].""");
}
echo $assocї"file"];
##Streaming or Opening
$browser_type = getenv("HTTP_USER_AGENT");
$query="select * from files where file_id = "$file_id"";
$result=mysql_query($query);
$assoc = mysql_fetch_assoc($result);
if (preg_match("/compatible; MSIE/i", "$browser_type")){
header("Content-type:".$assocї"type"]."");
header("Content-Disposition: inline; filename="".str_replace("\.exe","",$assocї"name"]).""");
}
else{
header("Content-type: audio/x-mp3");
header("Content-Disposition: attachment; filename="".$assocї"name"].""");
}
echo $assocї"file"];And it works pretty good for IE and Mozilla or NS 6.2 for the exceiption of Mozilla & NS trying to save a downloaded file as 'filename.mp3.exe'...still haven't been able to correct that.
I am also experiencing some difficulties with Macintosh IE 5.2 which when trying to download the file tries to save it as 'index.php' instead of the filename.mp3.
I imagine I would have to to an additional check if the platform is mac, but I have no idea which headers would properly start a download to save the file to the mac filesystem with the correct name because I don't have a mac to test on. If anyone has any experience with macs and headers, or just a lot of experience with headers