Reputation: 1477
I'm downloading a large file like that:
$fd = fopen($url, "r");
while(!feof($fd))
{
echo fread($fd, 4096);
ob_flush();
flush();
}
But I have one problem - the file is downloading only to 11,6 MB and stop... Where is a problem? I'm using ob_flush and flush so I think - it should work.
Thanks.
Upvotes: 0
Views: 673
Reputation: 158090
You don't need the fread()
loop if you just want to output a remote file. You can use:
readfile($url);
That's it. However, the script you showed should work as well. The reason must be on the remote server.
If the download takes long you should consider to set the execution time to unlimited:
set_time_limit(0);
... on top of your script.
Upvotes: 1