Scandir function not working on Live server

<?php
function pre_r($array){
	echo "<pre>";
	print_r($array);
	echo "</pre>";
}


$local_dir = 'http://html.trafficopedia.com/all/app/Filescletec/glamorousnap/';
$files = scandir($local_dir);
pre_r($files);

Live Link

Is there a way we can get this working on the Live server.

Current error:

**Warning** : scandir(./all/app/Filescletec/glamorousnap/): failed to open dir: No such file or directory in **/h**

Above all, if someone can educate me on how and why we get this error? I guess some path issue on Live server?

I was able to fix it:

$local_dir = $_SERVER["DOCUMENT_ROOT"].'/all/app/Filescletec/glamorousnap/';

2 Likes