Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSF and the fly likes fileupload -  filter out files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "fileupload -  filter out files" Watch "fileupload -  filter out files" New topic
Author

fileupload - filter out files

m yasmin
Greenhorn

Joined: Nov 11, 2008
Posts: 9
I am using the inputFileUpload tag. I want to filter out displayed files.

Any help will be appreciated.

Thanks,
Yasmin
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Use the 'accept' attribute. You're dependent on the web browser used though. Unfortunately almost all modern web browsers ignore it. Only Opera, which usually very strictly follows the w3 specs, uses it.

To get it to work in all web browsers, you can't go around embedding a Java Applet or Java Web Start Application (JNLP) in your JSF page. It runs entirely at the client side. This way you can just use for example the java.io.FileNameFilter to filter files.

That said, in the future please post JSF related questions at the JSF forum. You're talking about Tomahawk's t:inputFileUpload tag, which is a 3rd party JSF component which renders a HTML input type="file" element. It essentially has nothing to do with JSP as it is just a view technology.
[ December 23, 2008: Message edited by: Bauke Scholtz ]
m yasmin
Greenhorn

Joined: Nov 11, 2008
Posts: 9
Bauke,
Thank you for your response and sorry for posting a question that I thought was related to JSF.

Please allow me to rephrase my question. "Is there a way to filter out displayed files in JSF during file-upload?" I think your answer was no. Am I correct?

Thanks,
Yasmin
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
There is a way, but not using JSF nor plain HTML.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
And sorry about my comment about the forum. I was under the impression that this topic was posted at the JSP forum. Either a moderator moved it without notification or I need new glasses.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: fileupload - filter out files