File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "S:file tag restrict file types" Watch "S:file tag restrict file types" New topic

S:file tag restrict file types

Varun K. Gupta

Joined: Jun 14, 2009
Posts: 10

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

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.
I agree. Here's the link:
subject: S:file tag restrict file types
It's not a secret anymore!