note 37454 rejected from function.fread by vincent
| From: | vincent@php.net | Date: | Sat, 15 Nov 2003 22:22:04 +0000 |
| Subject: | note 37454 rejected from function.fread by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-60437@lists.php.net to get a copy of this message | ||
Note Submitter: tma@2p.cz
----
Is possible dispose buffer allocated by fread() - Something like read and forget - incremental read
?
Typical example (underscore added not to format as link):
$file = 'http_://www.something.com/longfile.exe';
$handle = fopen ($file, "rb");
do {
$data = fread($handle, 8192); // memory_limit !!!!
$n = StrLen($data);
if (!$n) {
breek;
}
writetootherfile($data);
Unset($data);
}
fclose($handle);
If memory_limit is applied, PHP raises exception (if file size exceeeds limit) "Allowed memory
size of 5242880 bytes exhausted (tried to allocate 8193 bytes)".