-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
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!
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.
Asked: 2022-10-25 16:31:46 +0800
Seen: 6 times
Last updated: Oct 27 '22