function drupal_ftp_file_to_ftp in Backup and Migrate 8.3
Same name and namespace in other branches
- 8.2 includes/destinations.ftp.inc \drupal_ftp_file_to_ftp()
- 6.3 includes/destinations.ftp.inc \drupal_ftp_file_to_ftp()
- 6.2 includes/destinations.ftp.inc \drupal_ftp_file_to_ftp()
- 7.3 includes/destinations.ftp.inc \drupal_ftp_file_to_ftp()
- 7.2 includes/destinations.ftp.inc \drupal_ftp_file_to_ftp()
Send a file to an FTP server.
1 call to drupal_ftp_file_to_ftp()
- backup_migrate_destination_ftp::_save_file in includes/
destinations.ftp.inc - Save to the ftp destination.
File
- includes/
destinations.ftp.inc, line 238 - Functions to handle the FTP backup destination.
Code
function drupal_ftp_file_to_ftp($file, $ftp_filename, $ftp_directory, &$ftp) {
if (!@drupal_ftp_connect($ftp)) {
return FALSE;
}
if ($source = drupal_realpath($file)) {
// Now we can try to write to the remote file
$complete_filename = $ftp_directory . '/' . $ftp_filename;
$put_file = @ftp_put($ftp->__conn, $complete_filename, $source, FTP_BINARY);
if (!$put_file) {
_backup_migrate_message('FTP Error: Couldn\'t write to @complete_filename when trying to save file on the ftp server.', array(
'@complete_filename' => $complete_filename,
), 'error');
return FALSE;
}
// Everything worked OK
return TRUE;
}
else {
_backup_migrate_message('FTP Error: Couldn\'t find @file.', array(
'@file',
), 'error');
return FALSE;
}
}