Hi Chaps,
I’m using readfile to force the download of a file:
set_time_limit(0);
$file = 'monkey.gif';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
flush();
And this works fine, however, I do have some software installation files that could be downloaded (these are in excess of 280Mb).
I have checked php.ini:
memory_limit = 128M
post_max_size = 300M
But Internet Explorer hangs and then crashes.
Is there a way to allow big files to download using this method, or is there another way of forcing the download, without php ‘reading’ the file first?
I’m guessing that the problem lies with the memory_limit being smaller than the file size. Is it a good idea to increase the memory_limit to eg. 280Mb?
Cheers