Home  >  Article  >  Backend Development  >  How to solve the warning when uploading files using FTP in PHP

How to solve the warning when uploading files using FTP in PHP

小云云
小云云Original
2018-03-31 13:05:132102browse

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.

  • TRUE = passive mode on

  • FALSE = passive mode off

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn