Re: comparison operators

From: Date: Mon, 21 May 2001 11:27:33 +0000
Subject: Re: comparison operators
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-53695@lists.php.net to get a copy of this message
On Monday 21 May 2001 08:03, Heidi Belal wrote: > I have a form where i let people choose a file to > upload, but i want to limit them to image files only. > So i want to only allow the .gif and .jpg to be > uploaded. What i tried doing was this: > if ($filename_type == "image/gif") > -- upload file > otherwise give an error message! > > but for some reason this doesn't work. It uploads any > kind of file without complaint! So what am i doing > wrong? Is there another operator to compare strings > for instance? Or what is the problem? == is perfectly fine for string comparison. Try doing a echo "'$filename_type'"; and (generally) a phpinfo (); to see what's passed to your script. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Those who will not reason, are bigots, those who cannot, are fools, and those who dare not, are slaves. - George Gordon Noel Byron (1788-1824), [Lord Byron]

« previous php.general (#53695) next »