Last active
August 29, 2015 14:26
-
-
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
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 | |
$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