I have a sever which people can upload files to. The problem is that some of the filenames are mangled (dont have any extension) and so I cannot immediately determine file type.
exif_imagetype() might work
make sure you have exif enabled.