Could someone please show me how to make subdirectories using mkdir shown via a listbox? I have tried numerous things, but mine just keeps making a directory where the script is located. Grr.
Here's my code. It's a tad different from the post I originally did because I started over to see if that might help. It didn't. This is so frustrating.
<form name="form1" action="<? echo $PHP_SELF ?>" method="post">
<?
if($rename)
rename($listbox,$value);
$dirname1 = getcwd();
if($chdir) {
$dirname = ("$dirname1/$listbox");
$ch = chdir("$dirname1/$listbox");
//I'm thinking it has something to do with right here. When it
//makes the dir, it doesn't seem to recognize this path. It just
//goes back to $dirname1
$mk = $ch;
}
else { $dirname = $dirname1;
$mk = $dirname1; }
if($mkdir) {
mkdir("$mk/$value"); }
?>
<select name="listbox" size=4>
<?
$dir = opendir ($dirname);
while ($file = readdir ($dir) ) {
if (is_dir($dir))
{ print "<option name=$file value=$file>$file/<br>"; }
else {
$filesize = filesize($file);
$kbfile = round($filesize/1024,2);
print "<option name=$file value=$file>$file ($kbfile kb)<br>";
}
}
closedir ($dir);
?>
</select>
<input name="value" type="text" value="">
<input type="submit" name="rename" value="Rename">
<input type="submit" name="chdir" value="Change Dir">
<input type="submit" name="mkdir" value="Make Dir">
</form>
Thank you for any help.
Happy Holidays!