PHP ftp_put fails with “Warning: ftp_put (): PORT command successful”

前端 未结 2 1402
萌比男神i
萌比男神i 2021-01-04 14:02

File is created on the FTP server, but its always 0 bytes large. Please give me a solution so that the file upload will working success.

I keep getting this warning

2条回答
  •  無奈伤痛
    2021-01-04 14:41

    PHP defaults to the active FTP mode. The active mode hardly ever works these days due to ubiquitous firewalls/NATs/proxies.

    You almost always need to use the passive mode.

    For that call the ftp_pasv after the ftp_login:

    ftp_pasv($nyambungkeftp, true);
    

    See my article on FTP connection modes, to understand, why you typically need to use the passive mode.

提交回复
热议问题