If you don't have access to DirectoryIterator class try this:
<?php
$path = "/path/to/files";
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ('.' === $file) continue;
if ('..' === $file) continue;
// do something with the file
}
closedir($handle);
}
?>