Not really, I'm in marital counseling with those commands right now. :mad:
Your solution is fine, were I to determine if an image already in the directory is an actual image, but I don't need to do that, I've already handled that before the image was ever uploaded.
Problem comes with this: I want to change the name of an image to something else.
Let's say I have /images/my_image.jpg
And I want to change it to: /images/my_image.xls
Obviously that would work in PHP but when your browser tries to access it it would think it's an Excel spreadsheet and not an image and damage ensues.... or worse, change to: /images/my_image.pif -> YIKES!
Anyway, what I have to do is this: when I decide to change image metadata such as the image name, I have to be sure that the name that I change the image name to is an actual "image"-like name, in other words, if I change it to "my_image.ext" then "my_image.ext" must be of a valid MIME type for an image before it is allowed to change the name of the image to that name.
And I'm sorry but getimagesize(), in this case, can't help me at all.
Phil