Here is nice example for your scenario with java. http://www.copperykeenclaws.com/how-to-find-a-files-image-type-by-looking-at-its-bytes-in-java/
– SelvarajMay 27 '14 at 08:51
I see that Mime type method is related to the HTTP server. For me this is in desktop.
– FarahMay 27 '14 at 08:52