This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes struts uplaod file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts uplaod file" Watch "struts uplaod file" New topic
Author

struts uplaod file

shabarish vai
Ranch Hand

Joined: May 26, 2008
Posts: 79
hi , m using struts to upload the file i want to restrict the uploaded file, like the uploaded file should not contain any special characters like
!@#$%^&*.. if it contains it has to throw an validation message.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30136
    
150

Shabarish,
I think you would need to add some logic to your action to validate this.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
shabarish vai
Ranch Hand

Joined: May 26, 2008
Posts: 79
Originally posted by Jeanne Boyarsky:
Shabarish,
I think you would need to add some logic to your action to validate this.


hi , m using struts to upload the file i want to restrict the uploaded file, like the uploaded file should not contain any special characters like
!@#$%^&*.. if it contains it has to throw an validation message

please explain me wit small code as am new to struts

thanks
Shabarish
Dhinesh Rajendran
Greenhorn

Joined: May 27, 2008
Posts: 5
Hi,

if you want to check the name of file then check it before submitting the action by Java Script.If You want to check the content of the file then you have to check in the Action class while reading/getting the content of the file .
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: struts uplaod file
 
Similar Threads
File Upload using Struts
File upload
Security Issues with File Upload
JSF and file upload
how to upload and download a file in struts 2