Show only PDF files in dropupload explorer window

asked 2022-10-25 16:31:46 +0800

softteam gravatar image softteam
130 1 8


I would like to know if there is any way to show only pdf files in the <dropupload> window when we click the explorer button and opens the Windows file explorer

This is the fiddle that I used: https://zkfiddle.org/sample/mh6l3f/1-dropupload-and-fileupload

Thank you!

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-10-27 18:33:49 +0800

MDuchemin gravatar image MDuchemin
2480 1 6
ZK Team

Hello there!

Long story short, the Fileupload#get method has A LOT of overloaded versions. The one you want in order to access the "accept" param which controls the mime types in the browser file explorer is this one:

Fileupload#get(Map<String, Object> params, String message, String title, String accept, int max, int maxsize, boolean alwaysNative, EventListener<UploadEvent> listener) {

see here: https://zkfiddle.org/sample/mh6l3f/7-dropupload-and-fileupload

Also, FYI Mime type declaration is "a hint that the browser will consider" rather than a hard rule. Some browser / OS can disregard it and almost all of them will let the user switch to . type. So you should still validate your file type after upload.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2022-10-25 16:31:46 +0800

Seen: 6 times

Last updated: Oct 27 '22

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More