1

I tried to make a code to download large files, I tried to download a file that its size is 1GB and it downloaded until 100MB & then failed, I need a code that downloads large files even if the user closed the tab.

ignore_user_abort(true);
file_put_contents('file.mp4', file_get_contents('http://domain/id.mp4'));
  • Maybe the download is slow. This means the download script will take too long. And there will be a Timeout. The time is a setting in php.ini. Default value I think is 30 sec. – halojoy Jan 07 '18 at 08:16
  • 1
    Apart from the time limit there's also a memory limit. See: https://stackoverflow.com/questions/6914912/streaming-a-large-file-using-php – KIKO Software Jan 07 '18 at 08:19

0 Answers0