Hiya

I am trying to find a way to drill down on html file names, if there are directories to display the files in the new directory. Im assuming this needs the calling of the same page which displayed the intial file names again with the argument of new directory. Does anyone have any tips for me.

I can establish whether a file is an dir or not using is_dir...just not sure how to pass this new directory name and concatenate with the existing path to now show the file names in the new drill down directory.

(Also Im not sure if my <a href statements are correct and wanted to know any good tutorials on string expressions?

So far I have knocked up this :

$start_dir = "C:/Program Files/ApacheGroup/Apache2/cgi-bin/";
//default starting directory
if ($new_dir ==0)
//if new_dir is not set display files from start_dir
{
$current_dir = "$start_dir";
}
else
{
$current_dir = "$start_dir.$new_dir";
//if new_dir is set than the current directory becomes
//the starting directory and the new directory selected
}

$inside_dir = opendir($current_dir);
//store contents of the file names in the current directory in $inside_dir

echo "Upload directory is $current_dir<br>";
echo "Directory Listing:<br><hr><br>";

while ($file = readdir($inside_dir))
if (is_dir($file))
{
echo "<a href=\"displaydir.phpfile=
".$file."\">".$file."</a><br>";

}

else
{
echo "<a href=\"openfile.php?
file=".$file."\">".$file."</a><br>";
}

closedir($inside_dir);



_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! http://messenger.msn.co.uk


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to