note 36755 deleted from function.fopen by didou
| From: | didou@php.net | Date: | Sun, 26 Oct 2003 17:33:36 +0000 |
| Subject: | note 36755 deleted from function.fopen by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59338@lists.php.net to get a copy of this message | ||
Note Submitter: mail@laeubi.de
----
If working with large files BE AWARE of the Memmory Limit.
I tried to open a file ~30mb and output it to the browser via:
$inp = fread ($fil, filesize($datei));
but it fails becuase of the Memmory Limit.
So you have to read your file per by per:
if (file_exists($datei)) {
$loops=filesize($datei)/6144;
#$fil = fopen (realpath($datei),"rb");
$fil = fopen (realpath($datei),"r");
for ($i = 1; $i < $loops; $i++) {
$inp = fread ($fil, 7000);
echo $inp;
}
fclose ($fil);
}
Works fine for me, hope that helps someone.