PHP directory reading. isdir(); isfile();

Hey all,
I was hopeing that someone who has experience in this could help me out…

Im creating a web gallery for someone and am trying to make it folder based.

so each folder = an album essentially.

My first issue is that PHP readdir’s functions are acting weird.

first of all.

using something simple like this:


if ($handle = opendir("$directory")) {

   while (false !== ($file = readdir($handle))) {
      
                   echo "file type:".filetype($file)."<br />
";
                   echo "<a href=\"gallery.php?album=".$_GET['album']."/".$file."\">".$file."</a><br />
";

   }
   closedir($handle);
}

…to basically echo something like this.
file type: dir
foldername

OK. It works for the two folders “.” and “…” but not for any of the folders that i create myself!:fight: is there something that I’m missing?

My goal is to have one file gallery.php and append the name of the gallery as a $_GET[] variable.

so folder/album summervacation = gallery.php?album=summervacation
etc…

I have the directory reading working fine depending on the get variable.

I just need to find a way to detect folders.

I was thinking of maybe checking to see if theres an extension and if there isnt then it must be a folder… Still thinking about it.

Any help would be appreciated.

Thanks,
Cesar