note 36755 added to function.fopen

From: Date: Tue, 21 Oct 2003 14:13:12 +0000
Subject: note 36755 added to function.fopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-59039@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.fopen.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36755 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36755&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36755&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59039) next »