Skip to content

Instantly share code, notes, and snippets.

@anant1811
Created July 25, 2016 15:43
Show Gist options
  • Save anant1811/0c10381be4e4c545bd93d5e5232b00b7 to your computer and use it in GitHub Desktop.
Save anant1811/0c10381be4e4c545bd93d5e5232b00b7 to your computer and use it in GitHub Desktop.
Transfer php script
<?php
set_time_limit(0); //Unlimited max execution time
$path = 'wp-content.zip';
$url = 'http://mysite.com/wp-content.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