Daniel,

I remembered reading about a Java class which could do that using a file's 
"magic numbers."  I think this library was
the one I am thinking about.  Using it, you could determine the file 
information in your Form bean, I think.  It was
called "ffident — Java metadata extraction / file format identification 
library."

URL: http://schmidt.devlib.org/ffident/index.html

=== Example: ===
File file = new File("filename");
FormatDescription desc = FormatIdentification.identify(file);
if (desc == null) {
  System.out.println("Unknown format.");
} else {
  System.out.prinlnt("Format=" + desc.getShortName() + ", MIME type=" + 
desc.getMimeType());
}
=== ===

Warning: If LGPL licenses bother you, don't use it.

Regards,
David

-----Original Message-----
From: Daniel Kies [mailto:[EMAIL PROTECTED]
Sent: Monday, January 16, 2006 1:44 PM
To: user@struts.apache.org
Subject: FormFile file type validation


Does anyone know of a validator that can be plugged into the validator
framework that will check file types for FormFile?  This would be so a user
can't upload certain extensions like .exe and the application will catch it.

thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to