Wednesday, July 22, 2009

Determine Mime type from bytes

If you have an image file stored in the database but don't have the extension of the file, then you may not know what the mime type should be.

There is a handy Java library that will inspect the bytes to determine the Mime type. The library can be found here:


It's fairly easy to use. An example code is shown below:

byte[] bytes;

No comments:

Post a Comment