readfile or fopen? (Passing file to user...)

From: Date: Mon, 11 Mar 2002 19:27:05 +0000
Subject: readfile or fopen? (Passing file to user...)
Groups: php.general 
Request: Send a blank email to php-general+get-88158@lists.php.net to get a copy of this message
Hi, I wonder if there's a better way (more effective, less resource consuming ) to pass a file to a user than the ones I put below. This might be quite large files more than 100 mb. Mind this might be all kind of files (binary and others) and must preserve the files state. //Sending approriate headers.... //snip ------------------------------------------------------Is this better, faster less consuming $fd=fopen($completeFilePath,'r'); fpassthru($fd); exit; --------------------------------------------------------than this? Seems like it, or is there yet another, faster, better way? $data = readfile($completeFilePath); $i=0; while ($data[$i] != ""){ echo $data[$i]; $i++; } exit; TIA / Jimmy

« previous php.general (#88158) next »