[eluser]dawnerd[/eluser]
I did some reason on the readfile function and I found that through some sly programming, you can mimic the readfile function, but have it read the file in chucks, thus avoiding the max memory errors.
Here's the code that was posted on php.net
Code:
<?php
function readfile_chunked($filename,$retbytes=true) {
$chunksize = 1*(1024*1024); // how many bytes per chunk
$buffer = '';
$cnt =0;
// $handle = fopen($filename, 'rb');
$handle = fopen($filename, 'rb');
if ($handle === false) {
return false;
}
while (!feof($handle)) {
$buffer = fread($handle, $chunksize);
echo $buffer;
ob_flush();
flush();
if ($retbytes) {
$cnt += strlen($buffer);
}
}
$status = fclose($handle);
if ($retbytes && $status) {
return $cnt; // return num. bytes delivered like readfile() does.
}
return $status;
}
?>
I'm sure I'm not the only one that could use this. Now, to get it to work in code igniter...