Java Inspect File Contents -


i have jee6 app accepts files via post. can perform server side basic test ensure file extension correct there way inspect file contents make sure don't process unless i'm happy valid file i.e. avoid renaming file extension

if know mime type of file, can try comparing value returned files.probecontenttype(tempfile) (documentation here).

mime types can have number of optional parameters (for example "text/plain; charset=utf-8"), may want compare using mimetype.match method rather comparing strings.


Comments

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -