hellonoko Posted December 19, 2007 Share Posted December 19, 2007 My simple script to read a directory returns an error: Warning: opendir(http://localhost/idea/gallery/) [function.opendir]: failed to open dir: not implemented in C:\www\idea\gallery\read_directory.php on line 3 <?php //Open images directory $dir = opendir("http://localhost/idea/gallery/"); //List files in images directory while (($file = readdir($dir)) !== false) { echo "filename: " . $file . "<br />"; } closedir($dir); ?> What does this mean? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/82407-solved-simple-directory-reading-script-errors/ Share on other sites More sharing options...
corbin Posted December 19, 2007 Share Posted December 19, 2007 You're trying to open the directory over http..... Chances are, that's not actually what you want to do... You should try using a server path, like: $dir = opendr('idea/gallery'); If the php file was above idea. Quote Link to comment https://forums.phpfreaks.com/topic/82407-solved-simple-directory-reading-script-errors/#findComment-418938 Share on other sites More sharing options...
VirusDoctor Posted December 19, 2007 Share Posted December 19, 2007 Try this instead... [qcode] <?php //Open images directory $dir = opendir("idea/gallery/"); //List files in images directory while (($file = readdir($dir)) !== false) { echo "filename: " . $file . "<br />"; } closedir($dir); ?> Quote Link to comment https://forums.phpfreaks.com/topic/82407-solved-simple-directory-reading-script-errors/#findComment-418939 Share on other sites More sharing options...
hellonoko Posted December 19, 2007 Author Share Posted December 19, 2007 Problem seems to be I cant read the directory that the php file is in. Got it fixed thanks! Quote Link to comment https://forums.phpfreaks.com/topic/82407-solved-simple-directory-reading-script-errors/#findComment-418945 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.