Hi all ...
I have script that looks like :
if(file_exists($filename)){
$len = filesize($filename);
//header("Content-type: attachment/pdf");
header('Content-Type: application/pdf');
//header("Content-Type: application/octet-stream");
header("Content-Type: application/force-download");
header("Content-Length: $len");
if(preg_match("/MSIE/", $_SERVER["HTTP_USER_AGENT"])){
header("Content-Disposition: attachment; filename=".$name.".pdf","pdf");
}else
{
header("Content-Disposition: attachment; filename=".$name.".pdf","pdf");
} //header("Content-Disposition: attachment; filename=personal_inventory_forms.pdf");
readfile($filename);
} else
{ echo $filename ; echo ' ERROR : file is not exist' ;
}
This script works very well on Mozilla, Opera and Safari..but doesnt work with IE. can someone help me to solve this problem ?
I suppose you are trying to force IE to download the pdf file, but it is always displaying it - you did not tell what is your problem.
IE determines the type of file from the extension, if it is a known extension it ignores the content-type header. You might want to try adding space char after the filename, I've heard it works.
PS: Second param to header should be bool
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php