[LIP] is_dir function in php

"Logu" <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <013301c4f7dd$64d106f0$140110ac@loguco>
Hi,

I wrote a small php script to distiguish the files and sub-directories of a 
directory. It lists the contents of the directory containing this script 
file. But for other directories it is unable to distinguish the diretory 
even though the directories has the apache user permission.

For example in the below given script. If the $mydir value is assigned with 
some other directory path other than the directory the script contains, it 
is not properly recognising directories.


Does anyone know how to overcome this.

Thanks
-logu

#------------------------------------------------------------------
<?php

$mydir=".";

 if ($handle = opendir("$mydir")) {
        while (false !== ($file = readdir($handle))) {
                 if( is_dir("$file") == true )
                         echo "$file is directory\n <br>";
                 else
                          echo "$file is file\n <br>";
         }
}
?>

#------------------------------------------------------------------ 




-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.