Problems with is_dir()
| From: | Jay | Date: | Thu, 29 Jul 2004 12:09:20 +0000 |
| Subject: | Problems with is_dir() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-192173@lists.php.net to get a copy of this message | ||
Hi!
I am trying to list all files and dirs in a directory. But i encountered some problems with is_dir() function. is_dir tells med that it all is files when i know for a fact that there is one dir in the directory ("dir1"). Can someone tell me why this don´t work?:
<?php
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"]."/img")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($file)){
echo "Dir: ".$file;
}
else
{
echo "File: ".$file;
}
echo "<br />";
}} closedir($handle); clearstatcache(); } ?> Thanx in advance J