Possible Duplicate:
Security threats with uploads
I'm allowing users to upload an image to our site. Am I right in thinking I should check the extension of the file .jpg/.jpeg/.gif as well as the mime type to make sure no dangerous files are uploaded?
Also should I resize the file upon upload to check that it is an actual image file, rather than a renamed exe or similar? Eg if the resize fails, then it's not a image file.
Are there any other forms of attack I should be guarding against?
Edit: Also adding an .htaccess file in the image folder so php files can't execute:
AddHandler cgi-script .php .php3 .php4 .phtml .pl .py .jsp .asp .htm .shtml .sh .cgi
Options -ExecCGI
order deny,allow
deny from all