How to read all file name in a folder in php?
Read all file name in folder or Directory Here is the script which will return you all file name from a folder or Directory <? if ($handle = opendir ('cartColor-60-75/')) { echo "Directory handle: $handle\n"; echo "Files:\n"; /* This is the correct way to loop over the directory. */ while (false !== ($file = readdir ($handle))) { echo "$file"; echo '<p></p>'; } /* This is the WRONG way to loop over the directory. */ while ($file = readdir($handle)) { echo "$file<br/>"; } closedir($handle); } ?>