I am having trouble making a new directory within a newly created directory. For instance, I make the directory dir/ and I want to add a new directory newdir underneath for "dir/newdir" and it's just not happening. The new directory (dir/newdir) goes underneath the base directory where dir/ is located. My code:
//If the directory is changed...
if($changedir) {
$dirname = "./$filedir";
$currentdir = $dirname; }
else {
$dirname = ".";
$currentdir = $dirname; }
//Making the directory...
if($create) {
if($type==dir) {
mkdir ("$currentdir/$newfiledir", 0777); }
//Code for browsing through directory
<select name="filedir" size=9 class="listbox"><?
$dh = opendir( $dirname ) or die("couldn't open directory");
while ( ! ( ( $file = readdir( $dh ) ) === false ) ) {
if ( is_dir( "$dirname/$file" ) )
print " ";
print "<option name=$file value=$file>$file<br>";
}
closedir( $dh );
?></select>
//My form:
<select name="type" size="2" class="ibox3">
<option value="file" selected>File
<option value="dir">Directory
</select><BR>
<input type="text" value="" name="newfiledir" class="ibox"><BR>
<input type="submit" name="create" value="Create New" class="button"><BR>
<input type="submit" value="Change Directory" name="changedir" class="button3">
Any help would be greatly appreciated. Thank you.