Skip to content

Instantly share code, notes, and snippets.

@carl-alberto
Created August 27, 2015 04:58
Show Gist options
  • Save carl-alberto/45563e09358a21dc2ffe to your computer and use it in GitHub Desktop.
Save carl-alberto/45563e09358a21dc2ffe to your computer and use it in GitHub Desktop.
ftp file transfer from one remote server to another
<?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