I have:
$r = mysql_fetch_array($query);
$filename = "db/" . $r['file_name'];
$rename = basename($filename);
header("Content-Type: application/octet-stream");
header("Content-Length: " . filesize($filename) . "");
header("Pragma: no-cache");
header("Expires: 0");
header("Content-Disposition: attachment; filename=$rename");
header("Content-Transfer-Encoding: binary");
$fp = fopen($filename, "r");
print fread($fp, filesize($filename));
fclose($fp);
exit();
Every time I actually try to use it, it ends the files in .exe and does not recognise the extension or mime tpye. All downloads are text, php or zips.