Last active
November 30, 2017 22:53
-
-
Save muhfaris/703c9d429a4879dd320e7636ab29e86f to your computer and use it in GitHub Desktop.
download file from php to server
This file contains hidden or 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 | |
$url = 'https://wordpress.org/latest.zip' ; //url file | |
$parse_url = parse_url($url) ; | |
$path_info = pathinfo($parse_url['path']) ; | |
$file_extension = $path_info['extension'] ; | |
$save_path = 'files/' ; //destination /name/folder/here | |
$file_name = 'name' . "." . $file_extension ; | |
file_put_contents($save_path . $file_name , fopen($url, 'r')); | |
# Create folder files | |
# set permission to 777 | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment