I would prefer getimagesize() to avoid problems with the mime-types, especially of JPEGs, where are a lot of mime-types are possible.(As Anomie wrote $_FILES["file"]["type"]
is the type as reported by the browser).
Try it, take some exotic filetype and give it an extension like .gif or .jpg.
$_FILES["file"]["type"]
will report something like 'image.gif' or 'image.jpeg', but getimagesize() will return false
, because it detects that the file is not an image.
This can be used to upload e.g. PHP-scripts onto the server.
Also note: never trust any uploaded file, images may be correct but can also contain PHP-code inside comments. So be sure that those images never can be included by any PHP-script on your server.(additionally you could check the image for PHP-code)