yxpblog
      <?php
      if(isset($_POST[\'upfile\'])){
    	$files=$_POST["text"];
	    if($files != ""){
        $ftp_ip = "192.168.1.151";
	    $ftp_user = "test2";
        $ftp_pwd = "test2";
	    $conn = ftp_connect($ftp_ip);
	    $login_result = ftp_login($conn, $ftp_user, $ftp_pwd);
	    $creafile = ftp_mkdir($conn,"$_POST[text1]");
    	$flag_file=0; 
        $dir = getcwd();
	    chdir("$CurrentPath");       //通过路径将上传文件夹指定为“指定的目录”;
	    $handle = opendir("$CurrentPath");
        while(($file = readdir($handle)) !== false)
        {
	    	if($file != "." && $file!= ".."){
	    	  $flag_file++;
	          $ftp = ftp_put($conn,"$_POST[text1]/$file","$file",FTP_BINARY);
		      if(!$ftp){
		           echo "上传失败";
		      }else{
		           echo " 上传成功";	    
		      }
		    }
        }
	   }else{
	     echo"<script language=javascript>alert(\'文件夹无效!\');history.back();</script>";
	   }
     }
     ?>

  这只是简单的上传,还需要加一些限制条件,这就需要你自己去加,不过核心还是能上传文件夹到FTP。。。

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-11-17
  • 2021-11-17
  • 2021-11-17
  • 2021-11-17
猜你喜欢
  • 2021-08-11
  • 2022-12-23
  • 2021-11-17
  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
相关资源
相似解决方案