NYCPHP Meetup

NYPHP.org

[nycphp-talk] Re: Using $_FILES["whatever"]["type"] correctly

Webapprentice . webapprentice at mail.com
Wed Jan 14 11:35:21 EST 2004


Dan,
Thanks for those tips as well.  Since you are the secon person to mention file -ib, I'll have to look into that as well as mime_content_type.

> In one case, $imageType was equal to "image/jpeg" but
it still fell into my error area.
> Why?  I thought at first it was "short-circuiting" on
the if statement, but that would apply to && conditions, right?

>>>There is indeed an error in the construction of your if statement. 
Your test will NEVER return FALSE.<<<

Oh shoot, I think I see why now... if $imageType was "image/jpeg," the other two conditions would always be true, and the || would always be true.  Doh!

>			$imageType =
$_FILES["frontimage"]["type"];
> 		
> 			// Check MIME Type
>			if ((strtolower($imageType) !=
"image/png") || (strtolower($imageType) !=
"image/jpeg") || (strtolower($imageType) !=
"image/gif")) 

I have violated programming 101. *bangs head at wall...metaphorically*

Thanks.

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm




More information about the talk mailing list