I use the below script to let my users download files. It works fine with txt, doc, jpg files but I seem to encounter trouble with PDFs. The browser (IE) then displays an empty page with a small picture in it (not related to my PDF) that looks like the icon for a picture that couldn´t be found did in early versions of IE. Anyone got any idea what the problem can be ?
if ($fd = fopen ($row[file_location], "r")){
$size=filesize($row[file_location]);
$fname = basename ($row[file_location]);
header("Content-type: application/force-download");
header("Content-Disposition: filename=\"$row[file_name]\"");
header("Content-length: $size");
while(!feof($fd)) {
$buffer = fread($fd, 4096);
echo $buffer;
}
fclose ($fd);
exit();
}