class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
The MIME type as sent by the browser is irrelevant, and cannot be trusted.
Here, your file is an image (even tough you changed the file extension), and the class recognizes it as an image, and therefore can process it.
Isn't what you want?