Home > php教程 > php手册 > body text

php 网页ftp 代码三 创建目录

WBOY
Release: 2016-06-13 11:22:11
Original
1086 people have browsed it

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;}
    $curDir=stripslashes($_POST[curDir]);
    $dirname=stripslashes($_POST[name]);
    
    if($dirname)
    {
     if($curDir=="/")
     {
      $dirpath=$curDir.$dirname;
     }else{
      $dirpath=$curDir."/".$dirname;
     }
     $rs=ftp_mkdir($ftp,$dirpath);
     if($rs)
     {
      echo "<script>alert('创建文件夹成功');history.back();</script>";
      exit;
     }else{
      echo "<script>alert('创建文件夹失败');history.back();</script>";
      exit;
     }
    
    }else{
      echo "<script>alert('文件夹不能为空');history.back();</script>";
      exit;
    }
?>


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template