https://dev.webpages.dk/  
 
PHP How to Create a Directory
How to Create a Directory:

Here you can learn how you create directories.
We use the PHP code mkdir for this, and you can on the PHP tab see how we use the snippet to create the dir in a subdir of the getcwd (Get Current Working Directory).

Look at the code on the PHP tab to the right.

 Create a Directory

How do you create a directory using PHP?

This example will show you how you create a Directory using PHP.
This is useful in situations like f.ex if you have a site where people can become members of a kind. Then it could be that you want the users to have their own directory, for images, configs and other files. So you will have to create a directory on the fly, right?
This short example shows you how to do just that, using PHP.

On the HTML tab you have though some forms, so your users can name the directory them self.
If you will use this for the first scenario then you will use the PHP snippet. Just change the directory names and fire the PHP code in some other way.

 HTML

<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>

 PHP

<?php
    if (isset($_POST['doit']))  { 
    $dirname = $_POST['dirname']; 
    $stien = getcwd(); 
    mkdir ($stien . "/" . $dirname); 
    echo "Okay, directory: " . $stien . "/" . $dirname . " have been created"; exit(); 
    } 
?>
Icons made by Freepik from www.flaticon.com This example shows you a way to create a directory using PHP.
03:31:10