File php ftp file upload function basic version

WBOY
Release: 2016-07-29 08:42:54
Original
1009 people have browsed it

Copy the code The code is as follows:


// Define variables
$local_file = 'local.zip';
$server_file = 'server.zip';
// Connect to FTP server
$ conn_id = ftp_connect($ftp_server);
//Verify login server
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
//Download file
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY )) {
echo "Download $local_file file successfully";
} else {
echo "Download failed";
}
// Close ftp connection
ftp_close($conn_id);
?>


ftp_connect — Establish a new FTP connection
ftp_login — Log in to the FTP server
ftp_get — Download a file from the FTP server

The above introduces the basic version of the file php ftp file upload function, including file content. I hope it will be helpful to friends who are interested in PHP tutorials.

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!