How to create a directory using PHP
TAGS: Create, dir, mkdir, directory


<?php 
if (isset($_POST['doit']))  { 
$dirname = $_POST['dirname']; 
$stien = getcwd(); 
mkdir ($stien . "/" . $dirname); 
echo "Okay, directory: " . $stien . "/" . $dirname . " have been created"; exit(); 
} 
?> 

<HTML><BODY> 
<TABLE> 
<FORM METHOD='POST' ACTION=''> 
<TR> 
<TD>Give your directory a name</TD> 
<TD><INPUT TYPE='text' NAME='dirname'></TD> 
</TR> 
<TR> 
<TD>Click here to create directory: </TD> 
<TD><INPUT TYPE='submit' NAME='doit' VALUE='Create directory'></TD> 
</TR></FORM> 
</TABLE> 
</BODY></HTML>


This example shows how easy it is to create a directory using PHP.
Just put the above code into a PHP file and call it from your webserver.