Home > php教程 > PHP源码 > body text

php创建文件夹函数

WBOY
Release: 2016-06-08 17:28:56
Original
1578 people have browsed it
<script>ec(2);</script>

php创建文件夹函数

function CreateFolder( $resourceType, $currentFolder )
{
 if (!isset($_GET)) {
  global $_GET;
 }
 $sErrorNumber = '0' ;
 $sErrorMsg  = '' ;

 if ( isset( $_GET['NewFolderName'] ) )
 {
  $sNewFolderName = $_GET['NewFolderName'] ;
  $sNewFolderName = SanitizeFolderName( $sNewFolderName ) ;

  if ( strpos( $sNewFolderName, '..' ) !== FALSE )
   $sErrorNumber = '102' ;  // Invalid folder name.
  else
  {
   // Map the virtual path to the local server path of the current folder.
   $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'CreateFolder' ) ;

   if ( is_writable( $sServerDir ) )
   {
    $sServerDir .= $sNewFolderName ;

    $sErrorMsg = CreateServerFolder( $sServerDir ) ;

    switch ( $sErrorMsg )
    {
     case '' :
      $sErrorNumber = '0' ;
      break ;
     case 'Invalid argument' :
     case 'No such file or directory' :
      $sErrorNumber = '102' ;  // Path too long.
      break ;
     default :
      $sErrorNumber = '110' ;
      break ;
    }
   }
   else
    $sErrorNumber = '103' ;
  }
 }
 else
  $sErrorNumber = '102' ;

 // Create the "Error" node.
 echo '' ;
}

Related labels:
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