Skip to content

Instantly share code, notes, and snippets.

@hugodias
Created October 11, 2012 20:24
Show Gist options
  • Save hugodias/3875247 to your computer and use it in GitHub Desktop.
Save hugodias/3875247 to your computer and use it in GitHub Desktop.
Unlimited file size limit PHP download
function readfile_chunked ($filename) {
$chunksize = 1*(1024*1024); // how many bytes per chunk
$buffer = '';
$handle = fopen($filename, 'rb');
if ($handle === false) {
return false;
}
while (!feof($handle)) {
$buffer = fread($handle, $chunksize);
print $buffer;
}
return fclose($handle);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment