I have a file-download script that works fine - you can open or save the file under the correct name and filesize. BUT, whilst the file is downloading I can't go to another page in my browser - i have to wait for the file to fully download before I can do so!
Here is the important part of the code I'm using....
// Cache
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-control: private");
// Force-download dialog
header("Content-Type: ".$rec['mimeType']);
header("Content-Disposition: attachment; filename=".basename($rec['fileName']).";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($docFile));
// Dump file and exit
$fd = fopen($docFile, "rb");
$fData = fread($fd, filesize($docFile));
fclose ($fp);
print $fData;
exit();
This script gets called via a simple URL link, eg: <a href="download.php?file=123">download me</a>
Can anyone spot what I'm doing wrong???