Re: force download in IE

From: Date: Fri, 24 Aug 2001 16:09:03 +0000
Subject: Re: force download in IE
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-64282@lists.php.net to get a copy of this message
I went through the same problem. the simplest solution with browsers like IE 5.5 is to click with the right buttom on the link an choose "save this location". You could mention this on the your page in a "if you have trouble dwonloading...." sentence. a very stable solution would be to make a selfextracting archive and provige two download links, one for people having the helper application installed and want to just view it or those who want to download it. David Minor schrieb: > 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);

« previous php.general (#64282) next »