I just started php a couple of months ago, beggining to get the hang of things. But one big problem I am having is with IE 7 and using headers to display a pdf. I have a link which opens a new window using javascript. The new window users headers to display the pdf. I have cut out all the validation stuff, essentially I have:
Code: Select all
$file = "../reports/{$_GET['file']}";
$name = $_GET['file'];
$fs = filesize($file);
header ("Content-Type: application/pdf");
header ("Content-Disposition: inline; filename=$name");
header ("Content-Length: $fs");
readfile ($file);
Drove me mad till I reasised what the problem was. Can anyone confirm that my code is ok, and that it is some kind of bug in the latest version of IE? Is there anyway round this to fix it?
The image attached is the error I am getting. Looks more like a JS error than a php, but I just don't know!
Thanks
Andy