help downloading .exe files through php/mysql
| From: | Tyler Longren | Date: | Fri, 29 Sep 2000 23:07:18 +0000 |
| Subject: | help downloading .exe files through php/mysql | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-18120@lists.php.net to get a copy of this message | ||
Hi everybody,
How do I make this pop up a download window. I'm wanting to download
the binary file in the db. Here's my code, the name of this is get.php:
<?
if($id) {
@MYSQL_CONNECT("localhost","root","myfunkypass");
@mysql_select_db("files");
$sql = @MYSQL_QUERY("select bin_data,filetype from binary_data where
id = '$id'");
$data = @MYSQL_RESULT($sql,0,"bin_data");
$type = @MYSQL_RESULT($sql,0,"filetype");
Header("Content-type: $type");
echo $data;
};
?>
It will display images, .jpeg, .jpg, .gif. Any image. But when it
tries to download a .exe file, it pop's up a download window, but it
makes you download get.php. After you download get.php, it has a bunch
of binary code in it, but it's not the binary of the file.
Can anybody help me out here? Thanks!
Regards,
Tyler Longren