Possible Duplicate:
Check whether a Directory Exists in PHP
I am trying scandir() to check contents of directories and sending path parameter using javascript and trying to load the contents in #container div:
$("#container").load("fetch_images.php?path="+pathvariable);
in fetch_images.php I am trying scandir($_GET['pathvariable']) to scan the elements of given directory. My problem is if proper path is not supplied using $_GET[‘pathvariable’] the page is showing some warning and error.
trying to scan like $files_dir_results = scandir($path); and using foreach() to display all results of the array.
I don’t want to show any kind of warning or error on output page. I know I can disable PHP warning but I will prefer any better option.
I don’t know how to check if scandir() is returing any error or warning. thanks.
You should first check if the path is valid with is_dir then scan it