title: HowTo extract MimeType from a byte[]
body: <p>I've a web page that that can be used to upload files.<br>
  Now I need to check if the file type is correct (zip, jpg, pdf,...).<br><br>
  I can use the mimeType that comes with the request but I don't trust the user and let's say I want to be sure that nobody is able to upload a .gif file that was renamed in .jpg<br>
  I think that in this case I should inspect the <a href="http://en.wikipedia.org/wiki/Magic_number_%28programming%29#Magic_numbers_in_files" rel="noreferrer">magic number</a>.<br>
  <a href="http://aperture.sourceforge.net/tutorial/mimetypes.html" rel="noreferrer">This</a> is a java library I've found that seems to achieve what I need 'extract the mimetype from the magic number'.<br>
  Is this a correct solution or what do you suggest?</p>
  
  <p><strong>UPDATE:</strong>
  I've found the <a href="http://sourceforge.net/projects/mime-util/" rel="noreferrer">mime-util project</a> and it seems very good and up-to-date! (maybe better then Java Mime Magic Library?)<br>
  <a href="http://www.rgagnon.com/javadetails/java-0487.html" rel="noreferrer">Here is a list</a> of utility projects that can help you to extract mime-types</p>