Re: [FRIDAY] Mime Type Validation

2010-07-21 Thread Stephen Turner
On Fri, 16 Jul 2010 10:26:11 -0400, Christopher Schultz ch...@christopherschultz.net wrote: If filename extensions are sufficient, you can get this information directly from the servlet container using ServletContext.getMimeType. There's also the activation framework's

[FRIDAY] Mime Type Validation

2010-07-16 Thread Stephen Turner
We're using Struts 2 for file uploading, and we're filtering the types of files people can upload by checking the file's content type against a list of allowed mime types. This turns out not to be reliable enough. Firefox in particular seems to sometimes provide the wrong mime type, so

Re: [FRIDAY] Mime Type Validation

2010-07-16 Thread Manos Batsis
On 07/16/2010 04:21 PM, Stephen Turner wrote: We're using Struts 2 for file uploading, and we're filtering the types of files people can upload by checking the file's content type against a list of allowed mime types. This turns out not to be reliable enough. Firefox in particular seems to

Re: [FRIDAY] Mime Type Validation

2010-07-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Manos, On 7/16/2010 9:42 AM, Manos Batsis wrote: On 07/16/2010 04:21 PM, Stephen Turner wrote: We're using Struts 2 for file uploading, and we're filtering the types of files people can upload by checking the file's content type against a list of

Re: [FRIDAY] Mime Type Validation

2010-07-16 Thread Greg Lindholm
My experience is that you cannot trust the mime-type supplied by the browser on a file upload. The same file uploaded with FF or IE will give you different mime-types. It's also dependent on what plugins have been installed in the browser. The only truly reliable methods would be to examine the

Re: [FRIDAY] Mime Type Validation

2010-07-16 Thread Greg Akins
I've used this before, and it seemed to work well. http://jmimemagic.sourceforge.net Some more alternatives are here http://www.rgagnon.com/javadetails/java-0487.html -- Greg Akins http://insomnia-consulting.org http://www.pghcodingdojo.org http://pittjug.dev.java.net