Prasad
Prasad

Reputation: 53

How to upload file to FTP server in PHP

My Code is to Upload file to FTP

 $conn_id = ftp_ssl_connect($ftp_server, 4480);
 $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
 ftp_pasv($conn_id, true);
 $upload = ftp_put($conn_id, "serverfile.txt", $file, FTP_BINARY);

Its giving this error

PHP Warning:  ftp_nb_put(): php_connect_nonb() failed: Operation now in progress (115) in /home/nanobi/PHP/ftp.php on line 51
PHP Warning:  ftp_nb_put(): Type set to I in /home/nanobi/PHP/ftp.php

Please help me to solve this

Upvotes: 3

Views: 244

Answers (1)

Roy Hvaara
Roy Hvaara

Reputation: 139

I think you might be experiencing Bug #55651: Option to force PHP to ignore the PASV address returned. There's an issue when an FTP server behind a NAT device returns its local address in response to the PASV command. There's been a patch submitted for this issue years ago, but it hasn't made it into the source yet.

If your FTP server is behind a NAT device, try another FTP client for PHP and see if the issue persists.

Upvotes: 1

Related Questions