Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function ftp_copy($source_file, $destination_file)
- {
- $ftp_server = 'ftp.server.com';
- $ftp_user = 'login';
- $ftp_password = 'password';
- $conn_id = ftp_connect($ftp_server);
- $login_result = ftp_login($conn_id, $ftp_user, $ftp_password);
- if((!$conn_id) || (!$login_result))
- {
- echo "FTP connection has failed!";
- echo "Attempted to connect to $ftp_server for user $ftp_user";
- }
- $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
- ftp_close($conn_id);
- if(!$upload)
- {
- echo "FTP copy has failed!";
- return false;
- }
- else
- {
- return true;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement