function drupal_ftp_ftp_to_file

cis7 drupal_ftp_ftp_to_file($file, $filename, $directory, &$ftp)
cle7 drupal_ftp_ftp_to_file($file, $filename, $directory, &$ftp)
elmsmedia7 drupal_ftp_ftp_to_file($file, $filename, $directory, &$ftp)
icor7 drupal_ftp_ftp_to_file($file, $filename, $directory, &$ftp)
meedjum_blog7 drupal_ftp_ftp_to_file($file, $filename, $directory, &$ftp)
mooc7 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/
Load from the ftp destination.


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


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);

  $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 message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.