R
Richard White
I'm developing a web site, which I test first on my PC (http://localhost/...) and then upload to the
web site on the internet when ok.
I have a little bit of PHP code (in file download.php) which I use to force the Save dialogue when I
want the user to download a PDF file. The hyperlink looks like:-
http://localhost/download.php?filename=my_pdf_file.pdf
This PHP works *fine* ... on the internet site - but *not* locally!!!
On the localhost, instead of prompting to download the PDF file, it prompts to download the PHP file
itself!
What do I need to do / configure (and HOW and WHERE please) to get this to work locally??
My local web server is Apache 2, and I'm using PHP 4.
The PHP code is just:-
<?PHP
header("Content-type: application/octet-stream");
header("Content-Length: ".filesize($filename));
header("Content-Disposition: attachment; filename=$filename");
$fp = fopen($filename, 'rb');
fpassthru($fp);
fclose($fp);
?>
Thanks!
web site on the internet when ok.
I have a little bit of PHP code (in file download.php) which I use to force the Save dialogue when I
want the user to download a PDF file. The hyperlink looks like:-
http://localhost/download.php?filename=my_pdf_file.pdf
This PHP works *fine* ... on the internet site - but *not* locally!!!
On the localhost, instead of prompting to download the PDF file, it prompts to download the PHP file
itself!
What do I need to do / configure (and HOW and WHERE please) to get this to work locally??
My local web server is Apache 2, and I'm using PHP 4.
The PHP code is just:-
<?PHP
header("Content-type: application/octet-stream");
header("Content-Length: ".filesize($filename));
header("Content-Disposition: attachment; filename=$filename");
$fp = fopen($filename, 'rb');
fpassthru($fp);
fclose($fp);
?>
Thanks!