eregi() problems...
| From: | jas | Date: | Tue, 16 Apr 2002 07:38:53 +0000 |
| Subject: | eregi() problems... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-93066@lists.php.net to get a copy of this message | ||
// 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