Re: It opens the file instead downloading

From: Date: Wed, 05 May 2004 21:26:46 +0000
Subject: Re: It opens the file instead downloading
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-185483@lists.php.net to get a copy of this message
I have *.mid files. I need a script that works in almost all browsers. ----- Original Message ----- From: "John W. Holmes" <holmes072000@charter.net> To: "Phpu" <phpu@go.ro>; <php-general@lists.php.net> Sent: Wednesday, May 05, 2004 10:51 PM Subject: Re: [PHP] It opens the file instead downloading > From: "Phpu" <phpu@go.ro> > > > header( "Content-type: application/force-download" ); > > if ((is_integer (strpos($user_agent, "msie"))) && (is_integer > (strpos($user_agent, "win")))) { > > header( "Content-Disposition: filename=".$filename); > > } else { > > header( "Content-Disposition: attachment; filename=".$filename); > > } > > header( "Content-Description: File Transfert"); > > @readfile($file_to_download); > > > > Instead downloading the file the script opens it. > > Why are you not sending "attachment" if it's IE? I simply use: > > header("content-type: application/vnd.ms-excel; name='excel'"); > header("content-disposition: attachment; filename=" . $filename . > ".xls"); > > and haven't had any trouble. You'll obviously want to adjust the > content-type, but I still send "attachment". > > ---John Holmes... > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#185483) next »