$daily_script_name = "file-name-to-upload";
$ftp_host = "your-ftp-host";
$uname = "user-name";
$pass = '********';
$remote = "your-remote-file-location/$daiy_script_name";
$ftpc = ftp_connect($ftp_host);
if (ftp_login($ftpc, $uname, $pass)) {
print ("FTP logged in...<br />\n");
} else {
print ("FTP could not login.<br />\n");
}
if (ftp_put($ftpc, $remote, $daily_script_name, FTP_BINARY)) {
print ("File was uploaded.<br />\n");
} else {
print ("File was not uploaded.<br />\n");
}
ftp_close($ftpc);
星期五, 二月 27, 2009
PHP脚本:上传ftp文件到指定目录
使用php可以很容易的实现向ftp服务器上传文件的功能,下面的脚本就实现了这个功能:
订阅:
博文评论 (Atom)
0 comments:
发表评论