I must be doing something wrong, for that solution did not work.

"Robert Cummings" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> jas wrote:
> >
> > // 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,
>
> I hope I'm reading right... it seems you want to filter OUT files with
> the extension '_4444.jpg' the above check appears to be filtering out
> everything BUT these files. I think you want the following check:
>
>     if( $file_names != "."
>         &&
>         $file_names !=".."
>         &&
>         !eregi( '_[0-9]{4}\.jpg$', $file_name) )
>
> Cheers,
> Rob.
> --
> .-----------------.
> | Robert Cummings |
> :-----------------`----------------------------.
> | Webdeployer - Chief PHP and Java Programmer  |
> :----------------------------------------------:
> | Mail  : mailto:[EMAIL PROTECTED] |
> | Phone : (613) 731-4046 x.109                 |
> :----------------------------------------------:
> | Website : http://www.webmotion.com           |
> | Fax     : (613) 260-9545                     |
> `----------------------------------------------'



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to