Dear Sirs,
  
my Apache/2.0.36(Win32) web server is running in combination with
PHP 4.2.1 as CGI on a Windows XP Professional machine.
Everything runs fine including some PHP software. Unfortunately
there is one exception.
  
I want to use PHP to provide PDF file download within my HTML code.
 
When I test the HTML and PHP code on my local PC (the Apache is
running as "localhost") I don't have any problem with the download
of PDF-files.
 
On the other side, when I access my remote machine (same
configuration than my local machine), the downloaded files are
destroyed.
The destroyed PDF files have the same size as the originals, but
the content is different.
I assume it is a question of how to process binary files.
  
Here the code of my "load.php" which is destined to provide the
download of PDF files:
<?php
            $path=getenv("QUERY_STRING");                     //
get the file path
            $filename=preg_replace("/.+\//","",$path);           //
separate the pure filename
            header("Content-Length: ".filesize($path));
            header("Content-Disposition: attachment;
filename=".$filename);
            readfile($path);
?>
 
If you have any idea what's going wrong, please let me know.
 
I would appreciate any help.
 
Thank you in advance and best regards,
Frank Lehmann


Reply via email to