Hi all,
I am having this really weird problem. I am using IE6 and have set up a script to download files from my website. It works fine, the files are downloaded, have non 0 file size and are not corrupted. That is, if I choose to save the file. If i choose to open it, i can see the download progressing but the application is having a problem when opening the file. I have tried PDF, Word doc and jpg. I have read something about a bug in IE, I was wondering if that could be related to my problem.
Thanks for helping.
Here is my code:
function send_file($file) {
$fname = basename($file);
if (file_exists($file)) {
// fix for IE catching or PHP bug issue
header("Pragma: public");
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
// browser must download file from server instead of cache
// force download dialog
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=\"" . $fname . "\"");
header("Content-Length: " . filesize ($file));
header("Content-Transfer-Encoding: binary");
readfile($file);
}
else {
print("Error: Could not open the file that you specified");
}
exit;
}