- Create a new php file as “download.php” in a public directory with the above code in it.
- Change the content of “$destination_folder” if needed.
- Create a new folder to store the downloaded file as “downloads” in the same directory as of download.php.
- Open the “download.php” file using browser and enter the location of file to be downloaded.
- Download will begin in background.
Note: You may need to setup php.ini config file as per your need. For my 200MB file, I set max_execution_time = 90000, max_input_time = 90000 and memory_limit = 256M. In shared hosting environment, a php.ini file can be placed in “public_html” folder.