View Single Post
  #1 (permalink)  
Old 07-08-2007, 04:10 PM
Blood08's Avatar
Blood08 Blood08 is offline
Jr. Programmer
Awards Showcase
Quality Tutorial Quality Tutorial 
Total Awards: 2
Join Date: Jun 2007
Location: Source Code
Posts: 98
iTrader: (0)
Blood08 is on a distinguished road
[Tutorials] Create a Directory

This is a easy way to create a directory which can be edited and put into upload scripts ect anyway
PHP Code:
<?php
if($_POST[submit]){ // Sees if the form has been submitted
$form $_POST['directory']; // Gets the field from the form
$directory $_SERVER['DOCUMENT_ROOT'] . "/" $form// Asks where the directory is going to be created
if (!is_dir($directory))  // Checks if the directory is already created

mkdir($directory0777); // Creates the directory and chmods it to 777

}
?> 
<form method="POST">
    <p><input type="text" name="directory" size="20" value="Directory Name"><input type="submit" value="Submit" name="submit"></p>
</form>
This has been tested and does work but if you are having problems with it saying something like
Quote:
Warning: mkdir(/home/****/public_html/Test) [function.mkdir]: Permission denied in /home/****/public_html/create.php on line 7
Then just go back to public_html and then change the permissions to 777 then it should work if its still not working please email me or pm me.

Thanks to Peterk92

__________________
Fersk Webmasters' Forum
Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote