Created
September 30, 2017 07:57
-
-
Save subrotoice/643fa77791b4a459a7e48ec7af67efdb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Download File form server to server | |
<?php | |
set_time_limit(0); //Unlimited max execution time | |
$path = 'latest.zip'; //can keep this name same | |
$url = 'https://wordpress.org/latest.zip'; | |
$newfname = $path; | |
echo 'Starting Download!<br>'; | |
$file = fopen ($url, "rb"); | |
if($file) { | |
$newf = fopen ($newfname, "wb"); | |
if($newf) | |
while(!feof($file)) { | |
fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 ); | |
echo '1 MB File Chunk Written!<br>'; | |
} | |
} | |
if($file) { | |
fclose($file); | |
} | |
if($newf) { | |
fclose($newf); | |
} | |
echo 'Finished!'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment