I have a php script that downloads a file (an executable as it happens) to the client's computer. I list the script is at the end of this message.
When I connect with Internet Explorer, there is a random long delay before I am asked where to save the file. I've measured this delay as 2 mins 40, over 3 mins and once I gave up after 7 mins (don't know if that one was ever going to download the thing).
If I use Firefox as the client, the file downloads in an instant, as it should as it's 400KB and I'm testing on a LAN.
Whichever client I use, the file is present and correct once it's apparantly downloaded.
My server runs Linux, Apache and PHP.
The file to download is in a separate part of the file system to /var/www. It's actually in /usr/share/downloads/
The script to download the file (called DownloadGizzyWatch.php) is invoked when the user clicks on this link in another file:
Code: Select all
<a href="DownloadGizzyWatch.php">Download GizzyWatch</a>TAI,
Lost Johnny.
DownloadGizzyWatch.php....
Code: Select all
<?php
include 'addresses.inc.php';
function _Download($f_location,$f_name){
// header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize($f_location));
header('Content-Disposition: attachment; filename=' . basename($f_name));
readfile($f_location);
}
{
session_cache_limiter('none'); //*Use before session_start()
session_start();
if (!session_is_registered("svUsername")
|| !isset($_SESSION["svUsername"])
|| empty($_SESSION["svUsername"])){
header("Location: http://" . $ServerAddress . "/arrivedinerror.html");
exit;
}
$file = 'GizzyWatch.exe';
_Download( "/usr/share/downloads/" . $file, $file);
}
?>