I want to handle big files(1-2Gb) downloads with php script and found two ways to do that:
and use this implementation:
header('Content-type: ' . $string);
header('Content-disposition: attachment; filename=' . $info['filename']);
$file = file_get_contents($filename);
echo $file;
or
readfile($filename);
But it takes too long to output the file. I suppose that the whole file has to be readed, before the output starts. It is more quickly when point the exact location of the file. Then it starts the output almost immediately.
I am looking for solution that streams the file or something. Any ideas?
You should consider using mod_xsendfile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With