I know there are various posts on this on the forum but most are dated pre 2005 and don't really give a definate solution. Since time has moved on I wonder if anyone has come up with one.
Trying to force a pdf to be opened or downloaded rather than opening in a browser window. However adobe keeps telling me the file is not recognised or corrupted and if I save it there is 0bytes showing.
Code I am using is as below and I am trying to get this to work in IE7.
Code: Select all
$filename = $row['fromdatabase'];
$filepath = "/folder/".$row['fromdatabase'];
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: application/pdf");
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filepath));
readfile($filename);
exit();Cheers