Hi
Can someone please help me..??? I am trying to put a link to a PDF file on a website and when I click it, there is NO 'grey box' with the options to open or save the PDF to a location on the computer. I know that the solution is some kind of PHP script to handle the processing of the PDF file.....and the following script was supposed to work.....BUT it does NOT. It does display that 'grey box' with the options. But then, when I press 'open', the script tries to open the PHP file itself and NOT the PDF file which is called 'A-ZInternetJargon.pdf'. Here is the script that I am using....is there anything wrong with it..?
<?php
$dir = 'PDFs/';
$file = basename($_GET['A-ZInternetJargon.pdf']);
if (is_readable($dir.$file))
{
header('Content-Length: ' . filesize($dir.$file));
header('Content-Type: application/PDF');
header('Content-Disposition: attachment; filename="'.$file.'"');
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
readfile($dir.$file);
}
else
{
header('HTTP/1.0 404 Not Found');
}
?>
I'm also using the following link to the script...not sure if it's right...
http://www.mywebsite.co.uk/get_pdf_f...f=filename.pdf
Does anyone know what is wrong with this...? Please help. Thanks.
Danny.