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

前端 未结 2 1403
萌比男神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:30

    Try two things:

    1. Try FTP_BINARY instead of FTP_ASCII
    2. Try to use passive mode doc here
    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题