Re: It opens the file instead downloading

From: Date: Wed, 05 May 2004 19:51:08 +0000
Subject: Re: It opens the file instead downloading
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-185480@lists.php.net to get a copy of this message
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...

« previous php.general (#185480) next »