Directory Entries
| From: | Dave Lampron | Date: | Tue, 09 Nov 2004 17:09:36 +0000 |
| Subject: | Directory Entries | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-201635@lists.php.net to get a copy of this message | ||
Hello I'm having problems with the following code:
if (! ($dp = opendir($imagesdir))) die ("cannot open $imagesdir.");
while($file = readdir($dp))
{
if ($file != '.' && $file != '..')
{
///////Second test doesn't seem to catch sub-directories under $imagesdir
if(is_dir($file)) ///// This is not evaluating properly!!!
{
echo "<td bgcolor=blue>";
echo $file;
echo "Directory";
echo "</td>";
}
else
{
echo "<td>";
echo $file;
echo "<br></a>";
echo "Filesize: ";
echo filesize($file); ///// This is not evaluating properly either!!!
echo "</td>";
}
}
}
closedir($dp);
echo "</tr></table><center></body></html>";
?>
Can't figure out why this doesn't work. I was thinking perhaps that it might
be directory permissions but that doesn't make sense. It would seem to me
that the ($file = readdir($dp)) is not returning any file attributes perhaps
just text. I could swear that I'v used this same routine to achieve these
results.
Any help appreciated!!
FYI: Running php as an ASAPI filter, on IIS 5.1, using Windows XP/2003,
using