First thanks for the code example! Can't get it to work though, I just added some print(); for troubleshooting. I can change the path to whatever I want (correct or faulty), it still just prints out:
Start of file
Looking in path: http://cambora.no-ip.com/test
End of file
The code below is the full code:
<?PHP
$path = 'http://cambora.no-ip.com/test';
$extension = 'jpg';
print("Start of file<P>Looking in path: $path<P>");
function getExFiles($path, $extension)
{
global $files;
if (is_dir($path))
{
if (substr($path, -1) == "/")
$path = substr($path, 0, -1); //get rid of /
$dh = opendir($path);
while (($file = readdir($dh)) !== false)
{
if ($file != '.' && $file != '..')
{
if (is_dir($path."/".$file))
{
getExFiles($path."/".$file, $extension);
print("1<BR>");
}
else
{
$pathInfo = pathinfo($path."/".$file);
if (isset($pathInfo['extension']) && $pathInfo['extension'] == $extension)
$files[] = $path."/".$file;
print("2<BR>");
}
}
print("3<BR>");
}
return $files;
print("Found: $files");
}
else
return false; //no point in continuing its not a directory bad call somewhere
print("Bad dir");
}
$files = array();
getExFiles($path, $extension);
Print("<P>End of file");
?>
Any ideas what might be wrong? And yes, I've searched for info and can't find anything... that's why I', posting here 🙂
[Edit]
The folder contains one jpg file (not an jpeg file, if that should make any difference)
[/Edit]