It opens the file instead downloading
| From: | Phpu | Date: | Wed, 05 May 2004 18:00:47 +0000 |
| Subject: | It opens the file instead downloading | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-185460@lists.php.net to get a copy of this message | ||
Hi,
I have this script taken form php.net
$filename=plenar.mid;
$file_to_download=files/plenar123.mid;
$user_agent = strtolower ($_SERVER["HTTP_USER_AGENT"]);
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.
I wanna save the file to disk not open it. How should i do it?
Thanks