[英]FTP Upload via PHP Script not working, but ftp_mkdir is working
I am trying to upload a file to an FTP Server via a PHP script. 我正在尝试通过PHP脚本将文件上传到FTP服务器。 The connection works and I can create subdirectories on the server.
连接有效,我可以在服务器上创建子目录。 However ftp_put gives the following error:
但是ftp_put给出以下错误:
Warning: ftp_nb_put() [function.ftp-nb-put]: php_connect_nonb() failed: Operation now in progress (115) in ... 警告:ftp_nb_put()[function.ftp-nb-put]:php_connect_nonb()失败:操作正在进行中(115)...
Warning: ftp_nb_put() [function.ftp-nb-put]: Type set to I in .... 警告:ftp_nb_put()[function.ftp-nb-put]:在...中将类型设置为I。
This is the script 这是脚本
$conn_id = ftp_ssl_connect($ftpHost);#
$login_result = ftp_login($conn_id, $ftpUser, $ftpPw);
ftp_pasv($conn_id, true);
// Verbindung überprüfen
if ((!$conn_id) || (!$login_result))
{
// no Connection
}else{
// Connection WORKS!
if(!@ftp_chdir ( $conn_id , $ftpDir )){
// ftp_mkdir WORKS!
@ftp_mkdir($conn_id, $ftpDir);
}//if(!@ftp_chdir ( $conn_id , $ftpDir )){
if (ftp_put($conn_id, $myFile, $targetfile, FTP_BINARY)) {
// Upload success: NOT WORKING!
}
}
}//if ((!$conn_id) || (!$login_result))
How can I change my script to get my desired behaviour? 如何更改脚本以获得所需的行为?
As you didn't provide us much useful information, I can only suggest that this is a network issue that prevents opening a data transfer connection. 由于您没有向我们提供很多有用的信息,因此我只能建议这是一个网络问题,它阻止了数据传输连接的打开。
For details refer to my article on FTP connection modes and necessary network configuration . 有关详细信息,请参阅有关FTP连接模式和必要的网络配置的文章 。
If you provide more details, like an FTP server log or any kind of network log (eg from Wireshark), you will likely get more concrete answers. 如果您提供更多详细信息,例如FTP服务器日志或任何类型的网络日志(例如,来自Wireshark的日志),则可能会得到更具体的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.