Created
August 27, 2015 04:58
-
-
Save carl-alberto/45563e09358a21dc2ffe to your computer and use it in GitHub Desktop.
ftp file transfer from one remote server to another
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 = 'filetosend.zip'; | |
$remote_file = 'destinationfilename.zip'; | |
$ftp_server = '127.0.0.1'; | |
$ftp_user_name = 'ftp@domain.com'; | |
$ftp_user_pass = 'ftpPASSWORD'; | |
$conn_id = ftp_connect($ftp_server); | |
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); | |
if (ftp_put($conn_id, $remote_file, $file, FTP_BINARY)) { | |
echo "uploaded this file: $file\n"; | |
} else { | |
echo "Error uploading $file\n"; | |
} | |
ftp_close($conn_id); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment