If I double click on the original file, in my file system, it opens without any problems in Adobe Reader.Could not open "filename.pdf" because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).
Here's the relavent PHP code:
Code: Select all
session_cache_limiter('must-revalidate');
header("Pragma: public");
header("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
header("Cache-Control: private");
header("Content-Description: File Transfer");
header("Content-Type: application/pdf");
header("Content-Disposition: attachment; filename=\"$asfname\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $fsize);
$file = fopen($file_path,"rb");
if ($file) {
while(!feof($file)) {
print(fread($file, 1024*8));
flush();
if (connection_status()!=0) {
fclose($file);
die();
}
}
fclose($file);
}
This is driving me crazy.
Help!