我正在尝试通过脚本将文件从我的网络服务器上传到我的游戏服务器。问题是它找不到目录。
完整目录为 /174.34.132.106 端口 27015/tf/addons/sourcemod/configs/tf2items.weapons.txt
这条路径不起作用,所以我向主机询问了它,他们坚持认为 /tf/addons/sourcemod/configs/tf2items.weapons.txt 是正确的路径,但这也不起作用。游戏服务器在 Windows 服务器上运行,我很确定 Web 服务器在 linux 上运行。我的代码错了吗,我必须用 %20 替换目录中的空格吗?提前致谢!
$ftp_server="174.34.132.106";
$ftp_user_name="Username";
$ftp_user_pass="Password";
$remote_file = "tf2items.weapons.txt";
$file = "weapons/tf2items.weapons.txt";//tobe uploaded
if(!file_exists($file)) echo "The local file does not exist";
$conn_id = ftp_connect($ftp_server) or die('Unable to create the connection');
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
ftp_chdir($conn_id, "174.34.132.106 port 27015/tf/addons/sourcemod/configs/");
echo ftp_pwd($conn_id);
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file\n";
exit;
} else {
echo "There was a problem while uploading $file\n";
exit;
}
// close the connection
ftp_close($conn_id);