title: Spring MVC Upload File - How is Content Type determine?
body: <p>I'm using Spring 3 ability to upload a file.  I would like to know the best way to validate that a file is of a certain type, specifically a csv file.  I'm rather sure that checking the extension is useless and currently I am checking the content type of the file that is uploaded.  I just ensure that it is of type "text/csv".  And just to clarify this is a file uploaded by the client meaning I have no control of its origins.</p>
  
  <p>I'm curious how Spring/the browser determines what the content type is?  Is this the best/safest way to determine what kind of file has been uploaded?  Can I ever be 100% certain?</p>
  
  <p>UPDATE:  Again I'm not wondering how to determine what the content type is of a file but how the content type gets determined.  How does spring/the browser know that the content type is a "text/csv" based on the file uploaded?</p>