Reply to Re: [PHP] duplicate filenames but different .extention

Your name:

Reply:


Posted by Philip Hallstrom on 12/19/05 03:03

> hello again
> I am trying to figure out how i can read the list of files in a directory
> using the opendir() and readdir() functions. Normally this goes fine but
> within the loop, what i am wanting to do is echo the filename if it is a jpg
> file, but if its a .gif, just continue.
> I have several files i wish to seperate based on the basename of the file.
> i read the basename help file and know how to use it even to exclude the
> .3letterextention. I am however wanting to skip if it happens to be a .gif,
> is there some sort of way to i guess, do the basename function in reverse,
> e.g if it comes across "xxxxxx.gif" it would skip it but not skip over the
> xxx.jpg files?
> that is my latest problem, it skips everything when i have a line like this
> in my loop
>
> if($file = basename('.gif',$file))
> continue;
> else go on with code
>

if ( ereg("\.gif$", $file) ) {
continue;
}

would do it.. so would

if ( substr($file, -4) == ".gif" ) {
continue;
}

Don't forget about ".GIF" though if that might be an issue for you...

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация