Reputation: 3794
I have a folder called images
in my current directory but when I try to run the code below I get the following error:
PHP Warning: scandir(../images,../images): The system cannot find the file specified. (code: 2) in C:\Program Files (x86)\Ampps\www\dev\php\recolor_png\dir.php on line 4
<?php
$dir = "../images";
$a = scandir($dir);
print_r($a);
I've tried every variation of the path I can think of (images, /images/, "images", 'images'
etc. but no joy.
var_dump (is_dir('/images'));
also gives false
Please help?
Upvotes: 1
Views: 5621
Reputation: 1285
I think your $dir is not correct.you can use
$dir = __DIR__ . "/images";
or
$dir = "./images";
Both are working. If its not working show me your image folder structure.
Upvotes: 2