title: Java: A way to match Mime (content) type to file extension from CommonsMultipartFile
body: <p>At my company, I need to compare the mime type to the file extension for extra reason. I have a <code>CommonsMultipartFile</code>. I am trying to figure out the best way to do this comparison. I have seen a <code>MimetypesFileTypeMap</code>, but not sure if that will work here. I am trying to avoid (or limit) any hard coding.</p>
  
  <p>I get the values as such:</p>
  
  <pre><code>CommonsMultipartFile file = ...;
  String fileName = file.getOriginalFilename();
  String contentType = file.getContentType();
  
  String extension = FilenameUtils.getExtension(fileName);
  </code></pre>
  
  <p>I appreciate any guidance and help on this. Thanks!</p>