0

Upload attribute accept multiple

asked 2019-05-14 15:10:14 +0800

Icestormfire gravatar image Icestormfire
1

updated 2019-05-15 17:33:51 +0800

cor3000 gravatar image cor3000
4531 2 7
ZK Team

I am trying to set a filter for an upload button which should support multiple extension some of which are compressed.

I am trying the following but it does not work

Button uploadButton = (Button) getFellow("uploadButton");
uploadButton.setUpload("true,maxsize=-1,multiple=false,native,accept=.csv|.csv.gz");

The problem is that it only recognizes .csv files while it ignores .csv.gz. A workaround is

uploadButton.setUpload("true,maxsize=-1,multiple=false,native,accept=.csv|.gz");

but this is not optimal since it accepts any kind of .gz file

Any help is more than welcome

delete flag offensive retag edit

3 Answers

Sort by » oldest newest most voted
0

answered 2019-05-15 17:46:31 +0800

cor3000 gravatar image cor3000
4531 2 7
ZK Team

updated 2019-05-16 12:11:56 +0800

I tried your example in this example on ZK fiddle using Chrome and Firefox (on Linux Mint) http://zkfiddle.org/sample/2nga7fi/1-file-upload-multiple-accept-types

Both browsers work showing files of either extension.

Can you test if the example works for you as well? Which browser/version and OS are you testing with?

UPDATE: IE11: shows the behavior you mention, however there's nothing in ZK you can change to fix the browser's behavior, the same effect happens with a native input element

updated example -> http://zkfiddle.org/sample/2nga7fi/2-file-upload-multiple-accept-types

MS-Edge: doesn't support the accept property at all (until the next version based on chromium) https://caniuse.com/#feat=input-file-accept

link publish delete flag offensive edit
0

answered 2019-05-16 16:18:01 +0800

Icestormfire gravatar image Icestormfire
1

Thanks for helping out.

I am currently using MacOS version 10.14.5. On Chrome and Safari it only accepts the .csv extension but not the .csv.gz

link publish delete flag offensive edit

Comments

I think there's not much I can do about browsers and their varying behavior. If you find a working hack please post here so we can consider adding this kind of "browser support" to ZK.

cor3000 ( 2019-05-16 18:32:21 +0800 )edit

Thanks anyway

Icestormfire ( 2019-05-17 10:16:38 +0800 )edit

I can confirm that Chrome on Mac 10.14.3 can't filter .csv.gz

hawk ( 2019-05-17 11:52:04 +0800 )edit
0

answered 2019-05-17 12:10:54 +0800

cor3000 gravatar image cor3000
4531 2 7
ZK Team

here another discussion regarding the varying behavior across browsers

https://stackoverflow.com/questions/181214/file-input-accept-attribute-is-it-useful

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

Follow
2 followers

RSS

Stats

Asked: 2019-05-14 15:10:14 +0800

Seen: 14 times

Last updated: May 17

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