Page 1 of 1
eregi(); problems...
Posted: Tue Jun 11, 2002 9:09 pm
by Jim
Code: Select all
//Image Validation
if(!eregi("їa-z0-9]+(ї_\\.-]їa-z0-9])"+"."+"їjpg]" $userfile)){
echo 'File is not a valid .gif or .jpg image!';
}
Surely I'm doing this wrong. I'm checking a file against this to make sure it has either a .jpg or .gif extension.
Anyone have any ideas on how to do this?
Thanks!
Posted: Wed Jun 12, 2002 1:57 am
by twigletmac
Try,
Code: Select all
<?php
if (!ereg('(.jpg|.gif)$', $userfile)) {
echo 'File is not a valid .gif or .jpg image!';
}
?>
There's a quick guide to regular expressions in the user submitted notes for
ereg().
Mac