Home > Backend Development > PHP Tutorial > php ftp function file upload_PHP tutorial

php ftp function file upload_PHP tutorial

WBOY
Release: 2016-07-20 11:01:07
Original
852 people have browsed it

Many other times we will not use the php ftp function to upload files, but when using more advanced WEB applications, we will use the ftp function. For example, I now want to transfer the uploaded pictures to server B and save the data to server A. , the ordinary PHP file uploading example cannot be used, but it can be easily implemented using the ftp function. ​

We will not use the ftp function file upload in PHP tutorials many other times, but we will use the ftp function when using more advanced WEB applications. For example, I now want to transfer the uploaded pictures to the B server and data. When saved to server A, ordinary PHP file uploading cannot be used, but it can be easily done using the ftp function.

//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 n";
} else {
echo "Download failed n";
}
// Close ftp connection
ftp_close($conn_id);
?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445457.htmlTechArticleMany other times we don’t use the php ftp function to upload files, but we do use more advanced WEB applications. The ftp function will be used when doing so. For example, I want to transfer the uploaded pictures to the B server...
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