Hi All,
I’m using a download script to download files from my site just so I don’t show the file path and don’t allow direct downloads.
Here’s the part that does the download after the database and logging stuff are taken care of:
[CODE]$speed = 500;
$fsize = filesize($fullPath);
header(“Pragma: public”);
header(“Expires: 0”);
header(“Cache-Control: must-revalidate, post-check=0, pre-check=0”);
header(“Cache-Control: public”);
header(“Content-Description: File Transfer”);
//header(“Content-Type: “.$mime_type);
header(“Content-Disposition: attachment; filename=””.$row[“file_name”].”””);
header(“Content-Transfer-Encoding: binary”);
header(“Content-Length: ” . $fsize);
$file = @fopen($fullPath,”rb”);
if ($file) {
while(!feof($file)) {
echo fread($file, round(1024*$speed));
flush();
sleep(1);
if (connection_status()!=0) {
@fclose($file);
die();
}
}
@fclose($file);
}
Now I have two questions/problems:
1) my speed is set to 500, doesn’t that mean max 500KB/sec? why am I only able to download at around 250KB/sec? If I remove the speed limits, then I can download up to 1.5MB/sec.
2) The main issues with this download script is while a file is being downloaded, I can’t navigate to any other page on my site. even if I have 3 or 4 tabs/windows open, none of the links within my site work anymore in any of the other windows until the download is completed.
I can however, navigate around the internet in other sites, just not my own site.
I’m pretty sure the issue is my download script because if I allow direct downloads, then I can navigate within the site while the file is being downloaded.
Thank a lot in advance for all your help.
SIA