This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes S:file tag restrict file types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "S:file tag restrict file types" Watch "S:file tag restrict file types" New topic
Author

S:file tag restrict file types

Varun K. Gupta
Greenhorn

Joined: Jun 14, 2009
Posts: 10
Hi

I am using s:file struts2 tag to upload multiple files. I want to restrict file type to PDF or XML while clicking on browser button.

Accept attribute is not supported by major browser. Is there any way when browser button is clicked, the "Chose file to upload" popup contains only File of type as PDF only.. currently it is showing me All File[*]...

Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

when we click on choose file in the pop up box we have display *.pdf are you expecting this.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Varun K. Gupta
Greenhorn

Joined: Jun 14, 2009
Posts: 10
yes Mohana, I am excepting only *.pdf it should not show me "All Files" or any other type in dropdown.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: S:file tag restrict file types