Hi,
I am setting up a website, and one section allows the download of files from a mySql database (v 3.23.21). I have no problems getting the file into the database but when I try and download, I receive a file which contains nothing (0 bytes). Can anyone help?? it would be greatly appreciated.
(i'm using php4)
/***** CODE *******/
<?php
/ General Include File /
include("tWXry21.php");
/ Test Authorization and IP Address /
include("testlogin.php");
$sql = "SELECT bin_data, filetype, filename, filesize * FROM binary_files WHERE id=$id_files";
$result = @mysql_db_query($CFG->dbname,$sq1,$primarylink);
$data = @mysql_result($result, 0, "bin_data");
$name = @mysql_result($result, 0, "filename");
$size = @mysql_result($result, 0, "filesize");
$type = @mysql_result($result, 0, "filetype");
header("Content-type: $type");
header("Content-length: $size");
header("Content-Disposition: attachment; filename=$name");
header("Content-Description: PHP Generated Data");
echo $data;
}
else
{
catcherror("File Reference Invalid",$CFG,$SESSION);
}
?>