Last active
August 29, 2015 14:26
-
-
Save sarathlal-old/af32033968b98d4902fa to your computer and use it in GitHub Desktop.
Transfer files from server to server with out FTP details.
This file contains 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
<?php | |
// Insert this file on server and go to the path from browser. | |
set_time_limit(0); //Unlimited max execution time | |
$path = 'newfile.zip'; // Name of the file to be saved on server | |
$url = 'http://your_old_domain.com/file.zip'; //File URL to be moved | |
$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