ambo Posted February 22, 2009 Share Posted February 22, 2009 Hello Im trying to to make it so readdir doesnt display folders <? $vProc = "../Process/"; $dir_handle = @opendir($vProc) or die("Error opening $path"); while ($file = readdir($dir_handle)) { if($file == "." || $file == ".." || $file == "index.php" ) { continue; } echo "<a href=\"view.php?file=$file\">$file</a><br>"; } // Close closedir($dir_handle); ?> Quote Link to comment Share on other sites More sharing options...
only one Posted February 22, 2009 Share Posted February 22, 2009 <? $vProc = "../Process/"; $dir_handle = @opendir($vProc) or die("Error opening $path"); while ($file = readdir($dir_handle)) { if($file != "." || $file != ".." || $file != "index.php" ) { echo "<a href=\"view.php?file=$file\">$file</a><br>"; } } // Close closedir($dir_handle); ?> Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted February 22, 2009 Share Posted February 22, 2009 if (!is_dir("../Process/".$file)) Quote Link to comment Share on other sites More sharing options...
ambo Posted February 22, 2009 Author Share Posted February 22, 2009 None of those worked it still displayed the folders Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted February 23, 2009 Share Posted February 23, 2009 None of those worked it still displayed the foldersLet's see the code you tried using is_dir() Quote Link to comment Share on other sites More sharing options...
wrathican Posted February 23, 2009 Share Posted February 23, 2009 the manual (http://uk2.php.net/manual/en/function.readdir.php) gives you the correct way to read a directory in the examples section! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.