Created
January 28, 2021 18:01
-
-
Save fhdalikhan/a26c86865c33ace95dfffe5c694393f6 to your computer and use it in GitHub Desktop.
Copy file from another server using PHP
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 | |
$file = 'http://domain/all.zip'; | |
$saveFileWithName = "backup.zip"; | |
$newfile = $_SERVER['DOCUMENT_ROOT'] . '/' . $saveFileWithName; | |
if (copy($file, $newfile)) { | |
echo "Copy success!"; | |
} else { | |
echo "Copy failed."; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment