Skip to content

Instantly share code, notes, and snippets.

@sarathlal-old
Last active August 29, 2015 14:26
Show Gist options
  • Save sarathlal-old/af32033968b98d4902fa to your computer and use it in GitHub Desktop.
Save sarathlal-old/af32033968b98d4902fa to your computer and use it in GitHub Desktop.
Transfer files from server to server with out FTP details.
<?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