I have posted this into phpbuilder.com where they are usually very helpful, but this time I am afraid their suggestions don't work....or it's the coder (which is highly probable
I am trying to make subdirectories underneath a new directory I have just created. It makes the directory, only it is located where the script is, not in the directory just created.
I've been informed not to use 'value' and that I need "" around my values for <option>; however, this does not affect the script. I set up a little page at http://www.sacredfalls.net/cpane/testing/ so you can see my problem. I've been working on this for the past 2 days and it is just so frustrating. Grr. Someone, please tell me what I'm doing wrong. I know the code's not perfect, but I started over trying to make it simple so I could see where the problem lie...but alas, that did not work. My code is below.
Code: Select all
<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>Happy Holidays.
Christina