File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Validating an image upload via Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Validating an image upload via "Validator-form.xml"" Watch "Validating an image upload via "Validator-form.xml"" New topic
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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Validating an image upload via "Validator-form.xml"
 
Similar Threads
validator frame work
how to validate map-backed?
DTD
Validation pattern.
validation in struts