Hi everyone,
Im running into some issues with IE dealing with PDF attachments. The code below will work if the user wants to download a PDF, but if I change Content-Disposition to attachment and allow them to open the PDF in the browser, IE says something like filename[1]not found (in my case the filename will be username.pdf). Does anyone have this working in IE 5.5 or 6? I read several suggestions on the forums here are would not have been able to get this working at all without the excellent people helping here. Thanks.
Dale
//Determine the appropriate filename for this user and attempt to send
//to the browser with a header
session_start();
$filename="$DOCUMENT_ROOT/reports/".$HTTP_SESSION_VARS["username"].".pdf";
if(file_exists($filename))
{
$size=filesize("$filename");
Header("Content-Type: application/pdf");
Header("Content-Disposition: inline; filename=$filename");
Header("Content-Length: $size");
header('Cache-Control: public');
$fp=fopen($filename,"rb");
while(!feof($fp)) {
$buffer = fread($fp, 4096);
print $buffer;
}
fclose($fp);
}
else
{
print "File Not Found";
}