sasori Posted July 29, 2008 Share Posted July 29, 2008 i made a test code that will show all the .php files in the directory, but how come when i try to open a different directory, it only shows the "index.php" when there are a number of php files in that directory, does this means, i should run the script in the same directory on which i want the files to be listed? <?php $directory = "../test2/"; $opendirectory = opendir($directory); while($filename = readdir($opendirectory)) { $filepath = $directory.$filename; if(is_file($filename) && ereg("\.php$",$filename); { $gallery[] = $filepath; } sort($gallery); foreach($gallery as $file) { echo "<br/>"; echo $file."<br/>"; } ?> Link to comment https://forums.phpfreaks.com/topic/117137-directory-help/ Share on other sites More sharing options...
MasterACE14 Posted July 29, 2008 Share Posted July 29, 2008 I wouldn't think so. Try specifying the full directory path. $directory = "../test2/"; including the root directory Link to comment https://forums.phpfreaks.com/topic/117137-directory-help/#findComment-602472 Share on other sites More sharing options...
sasori Posted July 29, 2008 Author Share Posted July 29, 2008 I wouldn't think so. Try specifying the full directory path. $directory = "../test2/"; including the root directory same.. it only shows the index.php alone these are the directories inside my wamp www root folder -test <-- am trying to display the .php files inside this folder but it only shows /test/index.php alone -test2 <-- this is where my scrip resides -php i tried different variations for the $directory $directory = "C:/wamp/www/test/"; $directory = "/www/test/"; $directory = "../www/test/"; $directory = "../test/"; but still, it doesn't show the other files..only the index.php of the test folder Link to comment https://forums.phpfreaks.com/topic/117137-directory-help/#findComment-602476 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.