Home >Backend Development >PHP Tutorial >How to solve the warning when uploading files using FTP in PHP
This article mainly shares with you how to solve the warning when uploading files using FTP in PHP. Company projects need to use FT to upload files. Just use the PHP extension method to upload. However, uploading files keeps failing and the directory list cannot be read. The main report is This error.
PHP Warning: ftp_put(): PORT command successful. Consider using PASV.
After searching online for a long time, it turned out that the reason was that FTP passive mode was not turned on.
Just use the method to turn on passive mode.
ftp_pasv(ftp_connection,mode)
ftp_connection | Required. Specifies the FTP connection to use (the identifier of the FTP connection). |
mode |
Required. Specify mode.
|
Remember to specify the mode after logging in so that you can upload, read directories and other operations.
Related recommendations:
FTP upload file and download file example code in PHP_PHP tutorial
PHP implements ftp upload File example, _PHP tutorial
Solution to uploading files via FTP
The above is the detailed content of How to solve the warning when uploading files using FTP in PHP. For more information, please follow other related articles on the PHP Chinese website!