View Single Post
Old 07-14-2008, 07:11 AM   #12 (permalink)
delayedinsanity
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

I wouldn't trust a file to be what it says it is, you may want to check out getimagesize() or mime_content_type() to get a definite result. With your method however, your method of getting the file extension breaks if there's multiple periods in the filename, so I'd suggest the following two lines:

PHP Code:
$allowed_filetypes = array('jpg','gif','bmp','png');

// and

$ext substr(strrchr($filename'.'), 1); 
-m
delayedinsanity is offline  
Reply With Quote