Click to See Complete Forum and Search --> : readdir & opendir problems


mikeyzc
05-28-2004, 12:36 PM
I keep getting errors when trying to open a directory then read the directory then echo the files to the screen...

Warning: opendir(http://www.mydomain.com/testing/images/): failed to open dir: not implemented in D:\mydomain website\testing\images\image.php on line 3




<?php

if ($handle = opendir('http://www.mydomain.com/testing/images')) {
echo "Directory handle: $handle\n";
echo "Files:\n";

while (false !== ($file = readdir($handle))) {
echo "$file\n";
}

closedir($handle);
}
?>

AdamGundry
05-28-2004, 01:58 PM
'http://www.mydomain.com/testing/images' is not a directory, it's a URL. Try using a relative path to the directory (IIRC it is '.' for the same directory as the PHP script is running in).

Adam