Re: Eregi for Image
| From: | jimw at apache dot org | Date: | Sun, 26 Aug 2001 21:32:47 +0000 |
| Subject: | Re: Eregi for Image | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-64532@lists.php.net to get a copy of this message | ||
Jeff Oien <jeff@webdesigns1.com> wrote:
> I want to check if an uploaded file is an image. This isn't working.
> Could anyone help me out?
>
> if (!eregi("\\.gif$", $img1_name) ||
> !eregi("\\.jpg$", $img1_name) ||
> !eregi("\\.jpeg$", $img1_name)) {
> error message
> }
unless you expect the file to have three extensions at once, you
probably mean && for each of the places you wrote ||.
or you could do this:
if (!ereg("\\.(gif|jpe?g)$", $img1_name)) {
error message
}
jim