| Author |
Validating an image upload via "Validator-form.xml"
|
Akshat Joshi
Greenhorn
Joined: Jun 28, 2010
Posts: 4
|
|
Hi,
I tried searching the internet but couldn't get anything regarding this topic.
I have a <html:file> in my jsp which uploads an image to the server. I want to validate this using the validator-rules.xml but can't figure out how to go about it.
Can someone please help me on how to define the rules in my validator-form.xml (this contains my validation for all the forms), so that I can validate the file to be uploaded.
Thanks in advance.
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8264
|
|
|
What are you trying to validate? That a file name was entered? That a file exists?
|
"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
|
 |
Akshat Joshi
Greenhorn
Joined: Jun 28, 2010
Posts: 4
|
|
Trying to validate whether the file is within the size limit and also if it is an image file.
I know I can do these validations in action level manually but I want to validate using the struts provided validation framework. Possible?
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8264
|
|
|
Not that I know of. I believe file upload is delegated to the Apache Commons FileUpload package, so file size limitations are enforced by it.
|
 |
 |
|
|
subject: Validating an image upload via "Validator-form.xml"
|
|
|