Skip to content

Instantly share code, notes, and snippets.

@carl-alberto
Last active August 29, 2015 14:26
Show Gist options
  • Save carl-alberto/c9d65ee6369714f71285 to your computer and use it in GitHub Desktop.
Save carl-alberto/c9d65ee6369714f71285 to your computer and use it in GitHub Desktop.
This simply copy a file from a url, useful when transferring a huge single zip file
<?php
$filename = "sample_filename.zip";
$file_to_be_copied = 'http://url_of_source.com/'.$filename;
$local_file_created = $_SERVER['DOCUMENT_ROOT'] . '/' . $filename;
if ( copy($file_to_be_copied, $local_file_created) ) {
echo 'Copy successfully in: ' .$local_file_created;
}else{
echo "Copy failed.";
}
/*
Don't forget to delete this file in your server as it can do potential damage
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment