D
D
Dmaw2021-06-11 14:34:03
PHP
Dmaw, 2021-06-11 14:34:03

Warning: ftp_fget(): Type set to A?

Good afternoon!
I'm trying to download a file from ftp, and everything seemed to work, then I changed the scripts, but it seems like everything remained as it was, it displays an error:

Warning: ftp_fget(): php_connect_nonb() failed: Operation now in progress (115) in /home/...... Warning: ftp_fget(): Type set to A. in /home/......

There is a file on ftp, a new file is created, but empty.
The code:
$ftp = ftp_connect('0000000', '10') or die ('<strong>FTP error</strong>');
    $login = ftp_login($ftp, '0000', '0000'); 
    if(!$login) exit('Ошибка подключения');
    ftp_pasv($ftp, true);

    $file = 'image.jpg';		
    
      $file_size = ftp_size($ftp, 'dir/'.$file);
      if ($file_size != -1) 
      {
        echo 'Файл существует<br>';

        $handle = fopen('/files/new.jpg', 'w'); // файл на сервере создаётся, он пустой	
         
        if(ftp_fget($ftp, $handle, 'dir/'.$file, FTP_ASCII, 0)) // ругается на эту строку
        {
          echo 'Файл успешно скачан<br>';
        } 
        else{
          echo 'Ошибка скачивания файла<br>';
        }
        
        fclose($handle);
      } 
      else{
        echo 'Файл не найден<br>';
      }

    ftp_close($ftp);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmaw, 2021-06-11
@Dmaw

In general, everything was decided, the script is working, FTP itself is to blame, the administrator opened the ports, it began to work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question