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

小云云
Release: 2023-03-22 21:12:02
Original
2099 people have browsed it

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.
Copy after login

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)
Copy after login
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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!