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); ?> Link to comment https://forums.phpfreaks.com/topic/146417-solved-readdir/ 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); ?> Link to comment https://forums.phpfreaks.com/topic/146417-solved-readdir/#findComment-768713 Share on other sites More sharing options...
Mark Baker Posted February 22, 2009 Share Posted February 22, 2009 if (!is_dir("../Process/".$file)) Link to comment https://forums.phpfreaks.com/topic/146417-solved-readdir/#findComment-768714 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 Link to comment https://forums.phpfreaks.com/topic/146417-solved-readdir/#findComment-768723 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() Link to comment https://forums.phpfreaks.com/topic/146417-solved-readdir/#findComment-768985 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! Link to comment https://forums.phpfreaks.com/topic/146417-solved-readdir/#findComment-769078 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.