I have the code below that lists all the images in a folder, the problem is that it finds some files ( a . and a ..) that I am not sure what they are so I a
while (($file = readdir($handle)) !== false) { if ( ($file == '.')|| ($file == '..') ) { continue; } $newfile = str_replace(' ', '_', $file); rename(IMAGEPATH . $file, IMAGEPATH . $newfile); $directoryfiles[] = $newfile; }