I am having trouble with scandir()
. I am trying to display the files in my snaps
-directory on a page under the subdomain in my cloud.
This is the PHP I used.
$files = scandir('./snaps');
print_r($files);
and this is the error.
Warning: scandir(./snaps) [function.scandir]: failed to open dir: No such file or directory in /home/u703778423/public_html/cloud/index.php on line 39
Warning: scandir() [function.scandir]: (errno 2): No such file or directory in /home/u703778423/public_html/cloud/index.php on line 39
I have no idea what else to do.
You probably assume, that the current work directory is next to the script scandir()
is written in, which (in many cases) isn't.
scandir(__DIR__ . '/snaps');
Given that error, your snaps directory would have to have the absolute path of
/home/u703778423/public_html/cloud/snaps
Make sure that this is the correct location for the directory, and that the webserver has the rights to access it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With