我正在连接到FTP服务器并尝试从中下载文件,但我收到错误
警告:ftp_get()[function.ftp-get]:无法打开/home/a*******/public_html/files/test.txt:/ home中没有这样的文件或目录第213行/a*******/public_html/MainHomescreen.php
if(isset($_REQUEST['download']))
{
// connect and login to FTP server
$ftp_server = "********.*****.***";
$ftp_username = "a*******";
$ftp_userpass = "******";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
if(isset($_POST['checkbox']))
{
foreach($_POST['checkbox'] as $selected)
{
//echo $selected;
$local_file = "local.zip";
$server_file = "/home/a*******/public_html/files/$selected";
// download server file
if (ftp_get($ftp_conn, $local_file, $server_file, FTP_BINARY))
{
echo "Successfully written to $local_file.";
}
else
{
echo "Error downloading $server_file.";
}
}
}
// close connection
ftp_close($ftp_conn);
}
它已连接到服务器,因为我已经检查过但是当我尝试下载文件时,它会出现上面的错误,但也会回显错误行。我不确定我在$ local_file和$ server_file中是否连接错了,这是我最好的选择。希望有人可以提供帮助。感谢。