|
楼主 |
发表于 2008 年 3 月 31 日 21:33:36
|
显示全部楼层
这是upload的代码
试了下 好象速度不行 不成
<?php
// get FTP access parameters
$host = ftp地址;
$user = 用户名;
$pass = 密码;
$destDir = 目标目录;
$workDir = 源目录; // define this as per local system
// get temporary file name for the uploaded file
// open connection
$conn = ftp_connect($host) or die ("Cannot initiate connection to host");
// send access parameters
ftp_login($conn, $user, $pass) or die("Cannot login");
// perform file upload
foreach(glob('{html/*.html,html/*.htm}', GLOB_BRACE) as $filename)
{///循环
echo 'Filename: ' . $filename ;
$upload = ftp_put($conn, $destDir."/".$filename, $workDir."/".$filename, FTP_BINARY);
// check upload status
// display message
if (!$upload) {
echo "......Cannot upload <br />";
} else {
echo "....Upload complete <br />";
}
}///循环
// close the FTP stream
ftp_close($conn);
// delete local copy of uploaded file
//unlink($workDir."/".$tmpName) or die("Cannot delete uploaded file from working directory -- manual deletion recommended");
?> |
|