Hello all... I've got a bit of a problem with IE6/7 handling "Content-type" and "Content-disposition" headers being passed from a PHP application which I wrote. When you click on the icon to download on the page, it calls another page (getpdf.php), which sorts out the location of the PDF file on the drive and calls the following three lines to actually deliver the PDF file:
//$sourcefile is the absolute path to the file on the hard drive.
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="' . $cert. '.pdf"');
readfile($sourcefile);
In Firefox, the download window comes up fine, asking what I want to do with the PDF (desired behavior). Under IE6/7, I instead get the download window in the background trying to download the getpdf.php file, with an error message "IE cannot download getpdf.php from www.quantumcalibration.com IE was not able to open this Internet site."
The same thing happens with another similar page (getcal.php), which sends out a .CAL file (data file used by the applications we develop in-house), but it uses "Content-type: application/octet-stream" instead... this gives me an Open/Save/Cancel dialog, but trying to open or save gives me the same "cannot download" error.
Links to the error messages: getpdf getpdf
Does IE not handle the Content-type or Content-disposition headers properly, or am I overlooking something?