Phpftp file upload function (Basic edition ). Copy the code as follows :? Phpdefined variables: local_filelocal.zip?server_fileserver.zip; connect to the FTP server $ conn_idftp_connect ($ ftp_server); verify the logon service
The code is as follows:
// Define variables
$ Local_file = 'local.zip ';
$ Server_file = 'server.zip ';
// Connect to the FTP server
$ Conn_id = ftp_connect ($ ftp_server );
// Verify the login server
$ Login_result = ftp_login ($ conn_id, $ ftp_user_name, $ ftp_user_pass );
// Download an object
If (ftp_get ($ conn_id, $ local_file, $ server_file, FTP_BINARY )){
Echo "Download $ local_file succeeded n ";
} Else {
Echo "Download failed n ";
}
// Close the ftp connection
Ftp_close ($ conn_id );
?>
Ftp_connect-create a new FTP connection
Ftp_login-log on to the FTP server
Ftp_get-download an object from the FTP server
The http://www.bkjia.com/PHPjc/322017.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/322017.htmlTechArticle code is as follows :? Php // defines the variable $ local_file = 'local.zip '; $ server_file = 'server.zip'; // connect to the FTP server $ conn_id = ftp_connect ($ ftp_server); // verify the logon service...