时间:2021-07-01 10:21:17 帮助过:3人阅读
$ftpserver=$_POST[ftpserver];
$ftpport=$_POST[ftpport];
$ftpuser=$_POST[ftpuser];
$ftppassword=$_POST[ftppassword];
$ftp=@ftp_connect($ftpserver,$ftpport);
if(!$ftp){ echo "连接FTP服务器".$ftpserver."的端口".$ftpport."失败";exit;}
$rs=@ftp_login($ftp,$ftpuser,$ftppassword);
if(!$rs){ echo "用户名或密码错误,连接FTP服务器失败";exit;}
$curDir=stripslashes($_POST[curDir]);
$localfile=str_replace("\","/",stripslashes($_POST[file1]));
if($localfile)
{
$filename=substr(strrchr($localfile,"/"),1);
if($curDir=="/")
{
$remotefile=$curDir.$filename;
}else{
$remotefile=$curDir."/".$filename;
}
$rs=ftp_put($ftp,$remotefile,$localfile,FTP_ASCII);
if($rs)
{
echo "";
exit;
}else{
echo "";
exit;
}
}else{
echo "";
exit;
}
?>
http://www.bkjia.com/PHPjc/445066.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445066.htmlTechArticlephp 网页ftp 代码二 文件上传 ?php $ftpserver=$_POST[ftpserver]; $ftpport=$_POST[ftpport]; $ftpuser=$_POST[ftpuser]; $ftppassword=$_POST[ftppassword]; $ftp=@ftp_connect($ftp...