Re: Serving a .dmg via readfile?
| From: | Brian Dunning | Date: | Thu, 26 Apr 2012 18:20:43 +0000 |
| Subject: | Re: Serving a .dmg via readfile? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317703@lists.php.net to get a copy of this message | ||
Thanks, this suggestion from Dante completely solved the problem.
Replaced:
readfile('/var/www/mypath/My Cool Image.dmg');
With:
$fd = fopen ('/var/www/mypath/My Cool Image.dmg', "r");
while(!feof($fd)) {
set_time_limit(30);
echo fread($fd, 4096);
flush();
}
fclose ($fd);
It's now serving all files properly.
On Apr 25, 2012, at 9:07 PM, D. Dante Lorenso wrote:
> You'll want to use fopen, fread, fwrite, and fclose to loop through bytes in your file as
> you shuttle chunks to the client instead of slooping it all into memory in one hunk.