You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Patrick Scheuerer <ta...@hispeed.ch> on 2003/12/29 17:34:16 UTC

File Upload Validator

Hi,

I have to validate a form which collects all the data connected with a 
document. Allong with discriptive information there's also a <html:file> 
element to upload the file itself. So far use a DynaValidatorForm to do 
validation. Everything works fine for the text based form elements. I 
would also like to validate the file (FormFile) for size (it shouldn't 
be bigger than e.g. 1 MB)  and MIME type (pdf, doc, exe, zip, etc.). Is 
there any extension for the Validator framework that can accomplish this?
Of course I could write my own validator class, I'm just curious if 
something like this has been done already and is a readily available.

Thanks, Patrick


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


RE: File Upload Validator

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
hi,

use <controller maxFileSize="1M"/>

set this in struts-config for maxFileSize.

look at file-upload-sample in your struts-distribution
There cames an error, if the file is bigger.

greetings

matthias


-----Original Message-----
From: Patrick Scheuerer [mailto:tabalooga@hispeed.ch] 
Sent: Monday, December 29, 2003 5:34 PM
To: Struts Users List
Subject: File Upload Validator


Hi,

I have to validate a form which collects all the data connected with a 
document. Allong with discriptive information there's also a <html:file>

element to upload the file itself. So far use a DynaValidatorForm to do 
validation. Everything works fine for the text based form elements. I 
would also like to validate the file (FormFile) for size (it shouldn't 
be bigger than e.g. 1 MB)  and MIME type (pdf, doc, exe, zip, etc.). Is 
there any extension for the Validator framework that can accomplish
this? Of course I could write my own validator class, I'm just curious
if 
something like this has been done already and is a readily available.

Thanks, Patrick


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


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