php 网页ftp 代码四 下载文件
$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;}
$targetDir=str_replace("\\","/",stripslashes($_POST[targetDir]));
$filename=substr(strrchr($_POST[filelist],"/"),1);
echo $filename;
// exit;
if(substr($targetDir,strlen($targetDir)-1)=="/")
{
$rs=@ftp_get($ftp,$targetDir.$filename,$_POST[filelist],FTP_ASCII);
}else{
$rs=@ftp_get($ftp,$targetDir."/".$filename,$_POST[filelist],FTP_ASCII);
}
if($rs)
{
if(substr($targetDir,strlen($targetDir)-1)=="/")
{
echo "<script>alert('文件下载成功,文件在本机中路径为[".$targetDir.$filename."]');window.close();</script>";
}else{
echo "<script>alert('文件下载成功,文件在本机中路径为[".$targetDir."/".$filename."]');window.close();</script>";
}
exit;我是
}else{
echo "<script>alert('文件下载失败,请检查目标文件夹是否存在,源文件为[".$_POST[filelist]."]');window.close();</script>";
exit;
}
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Linux new version
SublimeText3 Linux latest version
