Hi all
I am using the following code to force a file download when a user clicks the link:
if (file_exists($fileDir . $file)) {
header("Content-type: application/force-download");
header('Content-Disposition: inline; filename="' . $fileDir.$file . '"');
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($dir.$file));
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $file . '"');
readfile("$fileDir$file");
}
This works fine in FireFox and the user can either Open or Save the file however users of Internet Explorer 7 and 8 cannot open the file either directly or after saving it. The receive an error saying the file is corrupt and cannot be opened.
Any ideas where I am going wrong here?
Any thoughts or suggestions on a download script that you maybe use regularly that may help me out??
Thank you for reading.
K