note 51720 added to function.fread
| From: | planetiss at gmail dot com | Date: | Fri, 08 Apr 2005 12:38:43 +0000 |
| Subject: | note 51720 added to function.fread | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87700@lists.php.net to get a copy of this message | ||
For download the big files (more than 8MB), you must used ob_flush() because the function flush
empty the Apache memory and not PHP memory.
And the max size of PHP memory is 8MB, but ob_flush is able to empty the PHP memory.
header('Content-Type: application/force-download');
header ("Content-Length: " . filesize($file));
header ("Content-Disposition: attachment; filename=$theFileName");
$fd = fopen($file, "r");
while(!feof($fd))
{
echo fread($fd, 4096);
ob_flush();
}
----
Manual Page -- http://www.php.net/manual/en/function.fread.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51720
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51720&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51720&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51720&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51720&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51720&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51720&report=yes
Search -- http://master.php.net/manage/user-notes.php