Reputation: 138
I have a strange issue with opendir (same problem with glob):
$dir = "Y:\\\\foldername\\";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
echo "filename: $file\n";
}
closedir($dh);
}
}
Y:\ is a network folder with authentication. My webserver name is testweb and this script is called tree.php. Unfortunately my environment is windows based (php 5.2.5 ISAPI, windows 2003 server).
When I open the script from the same machine where IIS is running (http://testweb/tree.php ) everything works fine but if I connect to the same address from another machine (eg my laptop) I get the following error:
Warning: opendir().. failed to open dir. No error IN D:\web\tree.php
It seems a permissions issue but why it is working from the "local machine" and not from outside? How can I fix this?
Thanks for your help!!
Upvotes: 0
Views: 1372
Reputation: 2372
I had this error before even when I changed the permission and I logged in as admin the error persisted.
I solved this by giving the absolute path for the function opendir() that is instead of writing "subfolder" I wrote "C:\wamp\www\myproject\subfolder" and this solved my problem !
Thanks
Upvotes: 1
Reputation: 5397
check your permissions on that directory.. you can do it using the function called is_readable
Upvotes: 1