I am building a local filing system on my localhost.
I can display all of the files and can link to the files, but I want to identify if a file is a directory so I can apply a special link to it. SO…
<?php
$dir = "something/afolder/"
$filenamejj = $dirArray[$index];
$isdir = is_dir($dir);
if($isdir) {
$ext = end(explode('.', $filenamejj));
print("<TR><TD><a href='filer.php?dir=$dir/$filenamejj'>$dirArray[$index]</a></td><td>Directory</td>");
} else {
$ext = end(explode('.', $filenamejj));
print("<TR><TD><a href='openfile.php?$dir/$filenamejj'>$dirArray[$index]</a></td><td>$ext</td>");
}
print("</TR>\
");
This is just a snippet which is the conditional statement to decide whether it is a directory or not. For some reason, it always says that the files are not directories, even when I know when one isn’t.
If anyone could help me that would be great thanks!
Jordan