note 93337 deleted from function.readfile by danbrown
| From: | danbrown@php.net | Date: | Thu, 03 Sep 2009 19:23:21 +0000 |
| Subject: | note 93337 deleted from function.readfile by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160203@lists.php.net to get a copy of this message | ||
Note Submitter: skelly
----
re: gaosipov at gmail dot com @ 09-Oct-2008 09:08
I had to modify your f.smartReadFile() {} to include buffer flushing after each chunk or else I
would still have the same issues with malloc because the whole file would be read into a buffer
before delivery.
I simply changed the loop as so:
<?php
//...
while(!feof($fm)&&$cur<$end&&(connection_status()==0)) {
print fread($fm,min(1024*16,$end-$cur));
$cur+=1024*16;
ob_flush();
flush();
}
//...
?>