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

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



Reply via email to