0

我正在尝试使用 FTP 将文件从一台服务器传输到另一台服务器,但在我的代码中看不到错误。它只显示来自 ELSE 的消息。

我是否在 FTP 连接或文件路径方面犯了错误?

/* Remote File Name and Path */
$remote_file = "output/5e18704b91013.mp4";

/* FTP Account (Remote Server) */
$ftp_host = '*****'; /* host */
$ftp_user_name = '******'; /* username */
$ftp_user_pass = '****'; /* password */

/* File and path to send to remote FTP server */
$local_file = "video.mp4";

/* Connect using basic FTP */
$connect_it = ftp_connect( $ftp_host );


/* Login to FTP */
echo $login_result = ftp_login( $connect_it, $ftp_user_name, $ftp_user_pass );

/* Send $local_file to FTP */
if ( ftp_get( $connect_it, $remote_file, $local_file, FTP_BINARY ) ) {
    echo "WOOT! Successfully transfer $local_file\n";
}
else {
    echo "Doh! There was a problem\n";
}

/* Close the connection */
ftp_close( $connect_it );
4

0 回答 0