// second selection for main image on main page $dir_name = "/path/to/images/directory/"; $dir = opendir($dir_name); $file_lost .= "<p><FORM METHOD=\"post\" ACTION=\"done.php3\" NAME=\"ad01\"> <SELECT NAME=\"images\">"; while ($file_names = readdir($dir)) { if ($file_names != "." && $file_names !=".." && eregi('_[0-9]{4}.jpg$', $file_name)) { $file_lost .= "<OPTION VALUE=\"$file_names\" NAME=\"$file_names\">$file_names</OPTION>"; } } $file_lost .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"select\"></FORM></p>"; closedir($dir);
My problem is with the eregi() function to filter out files without the following criteria *_4444.jpg, it must have an underscore followed by 4 numbers and then ending in .jpg file extension. I have tried a few different methods to try and get this to work however I think I am missing something. All of the documentation I have read on php.net states that this string should work as is... I have checked the contents of the directory and I only have files of these two types... filename_logo.jpg filename_0103.jpg Could anyone enlighten me on how this is not working? Thanks in advance, Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php