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
sometimes provide the wrong mime type, so some valid files are being
rejected.

My question is: has anyone come across a reliable way to detect a file's
mime type?

When dealing with a finite set of MIME types, we usually map those to file extensions. We then only allow those extensions to be used in uploaded files.

hth,

Manos

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to