Hi. I am using Linux/Apache with PHP 4.1.2. I have been experiencing this problem since upgrading from an earlier version of PHP 4.

My script forces a download of a PDF file after looking up some info in a database. The code looks like this:


$file="/path/to/file";
$fp = fopen($file, "r");
$size=filesize($file);
$contents = fread($fp, $size);
fclose($fp);

Header("Content-Type: $type");
Header("Content-Disposition: attachment; filename=$downloadname");
header("Content-Length: $size");
header("Content-Transfer-Encoding: binary");
echo $contents;

filesize() is reporting the size properly. The code works perfectly for smaller files, but the fread() fails for files larger than 19 MB or so and I got a page cannot be displayed error. I know that it is fread() which is causing the problem because I commented out all the code that follows it and still get the error. All the files being downloaded are PDF files.

Can anyone shed some light on this?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to