Note that there quite a few articles on the net that imply that commands like is_dir, opendir, readdir cannot read paths with spaces.
On a linux box, THAT is not an issue.
Sample test code;
$dir = "Images/Soma ALbum Name with spaces";
echo $dir."<br/>";
// Open a directory, and read its contents
if (is_dir($dir)){
echo $dir."<br/>"; // will not appear if above fails
if ($dh = opendir($dir)){
echo $dir."<br/>"; // will not appear if above fails
while (($file = readdir($dh)) !== false){
echo "filename:" . $file . "<br>";
echo $dir."<br/>"; // will not appear if above fails
}
closedir($dh);
}
}