force download in IE
| From: | David Minor | Date: | Sun, 19 Aug 2001 05:40:43 +0000 |
| Subject: | force download in IE | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-63354@lists.php.net to get a copy of this message | ||
Can anybody tell me why this doesn't work in IE? I need to force download
mp3 files instead of IE5.5 trying to apply a helper app. This code works
fine for NN.
// detect for MSIE bug
if (strstr($HTTP_USER_AGENT, "MSIE"))
$attachment = "";
else
$attachment = " attachment;";
// stream file to user
header("Content-Type: application/octet-stream");
header("Content-Disposition:$attachment filename=$filename");
header("Content-Length: ".filesize($tmp_file));
header("Content-Transfer-Encoding: binary");
readfile($tmp_file);