In the download.php :
$file_size = filesize($file_path);
$fp = fopen($file_path, "r");
if ($fp) {
$file_data = fread($fp, $file_size);
fclose($fp);
}
$file_size is OK
if (eregi("MSIE", getenv("HTTP_USER_AGENT"))) {
$disposition = ($action != "zip" && $action != "lightbox") ? 'attachment' : 'inline';
header("Content-Disposition: $disposition; filename=".$file['file_name']."\n");
header("Content-Type: application/x-ms-download\n");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
}
elseif (eregi("Opera", getenv("HTTP_USER_AGENT"))) {
header("Content-Disposition: attachment; filename=".$file['file_name']."\n");
header("Content-Type: application/octetstream\n");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
}
else {
header("Content-Disposition: attachment; filename=".$file['file_name']."\n");
header("Content-Type: application/octet-stream\n");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
}
header("Last Modified: ".gmdate("D, d M Y H:i:s")."GMT\n");
header("Expires: 0\n");
header("Content-Length: ".$file['file_size']."\n");
if (eregi("Mac", getenv("HTTP_USER_AGENT"))) {
header("Content-Transfer-Encoding: binary\n");
header("Accept-Ranges: bytes\n");
header("Connection: close\n");
}
echo $file['file_data'];
$file['file_size'] is corresponding to the file size that I've downloaded so it means that we may just need to replace this incorrect value (between 0-1000 bytes) by the correct value (above) which is between (1000-100000 bytes) - the correct file size - for the browser.
I hope it will help!
AL