Advertisement
Shell_Casing

PHP mkdir()

Mar 19th, 2018
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1.  
  2.     <?php
  3.  
  4.     // The directory path
  5.  
  6.     $dir = "testdir";    
  7.  
  8.     // Check the existence of directory
  9.  
  10.     if(!file_exists($dir)){
  11.  
  12.         // Attempt to create directory
  13.  
  14.         if(mkdir($dir)){
  15.             echo "Directory created successfully.";
  16.         } else{
  17.             echo "ERROR: Directory could not be created.";
  18.         }
  19.     } else{
  20.         echo "ERROR: Directory already exists.";
  21.     }
  22.     ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement