function drupal_ftp_ftp_to_file

cis7 destinations.ftp.inc drupal_ftp_ftp_to_file($file, $filename, $directory, &$ftp)
cle7 destinations.ftp.inc drupal_ftp_ftp_to_file($file, $filename, $directory, &$ftp)
elmsmedia7 destinations.ftp.inc drupal_ftp_ftp_to_file($file, $filename, $directory, &$ftp)
icor7 destinations.ftp.inc drupal_ftp_ftp_to_file($file, $filename, $directory, &$ftp)
meedjum_blog7 destinations.ftp.inc drupal_ftp_ftp_to_file($file, $filename, $directory, &$ftp)
mooc7 destinations.ftp.inc drupal_ftp_ftp_to_file($file, $filename, $directory, &$ftp)

This function tries to retrieve the contents of a file from the FTP server. Firstly it changes into the $directory directory, and then attempts to download the file $filename. The file is saved locally and its contents are returned to the caller of the function.

1 call to drupal_ftp_ftp_to_file()
backup_migrate_destination_ftp::load_file in sites/all/modules/ulmus/backup_migrate/includes/destinations.ftp.inc
Load from the ftp destination.

File

sites/all/modules/ulmus/backup_migrate/includes/destinations.ftp.inc, line 204
Functions to handle the FTP backup destination.

Code

function drupal_ftp_ftp_to_file($file, $filename, $directory, &$ftp) {
  // Change into the remote directory and retrieve the content
  // of a file. Once retrieve, return this value to the caller

  if (!@drupal_ftp_connect($ftp)) {
    return FALSE;
  }

  // We are now connected, so let's retrieve the file contents.
  // Firstly, we change into the directory
  $chdir = @ftp_chdir($ftp->__conn, $directory);

  if (!$chdir) {
    _backup_migrate_message('FTP Error: Couldn\'t change into directory: @directory', array('@directory' => $directory), 'error');
    return FALSE;
  }

  // We have changed into the directory, let's attempt to get the file
  $fp = @fopen($file, 'wb');
  $get_file = @ftp_fget($ftp->__conn, $fp, $filename, FTP_BINARY);
  fclose($fp);

  $fp = NULL;

  if (!$get_file) {
    _backup_migrate_message('FTP Error: Unable to download file: @filename from @directory', array('@filename' => $filename, '@directory' => $directory), 'error');
    return FALSE;
  }

  return TRUE;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.