-
[PHP] Directories
Hey, I'm currently doing a 'project' for my college, and I need a script which merged with a HTML form could automaticly generate a directory which could later store files as such.
Not much to offer apart from my gratitude. However I will reward reputation, not much of a reward but 'meh...
Thank you, James.
-
As in, create a directory?
PHP Code:
mkdir('/somewhere/newdirectory');
You can also specify the mode of the new directory.
PHP Code:
mkdir('/somewhere/newdirectory', 0755);
-
make.php
PHP Code:
<?
$directory = $_POST[directory];
mkdir('$directory');
?>
HTML Form
Code:
<form action="make.php" method="post">
<input type="text" name="directory"></input>
<input type="submit" name="submit" value="Make the Directory">
</form>
Then type whatever in the textbox
e.g /robbiegray/isthe/best
-
Perfect!
Thank you, reputation will be awarded as stated, although it doesn't look like Nets needs any more but 'meh.
Edit'o: Nets I need to spread grr.
-
Make sure you chmod the make file..
-
-
-
-
You need to change the mode of the directory you're creating the new directory in. Also, you might want to check that there's only letters and numbers in the folder's name.
PHP Code:
function cd($d) {
$rx = "/^[a-zA-Z1-9]+$/";
return preg_match($rx, $d);
}
-
Make sure your useing the correct abosulte path to the dir you want to create also.