fileupload accept attribute

asked 2014-03-18 10:54:12 +0800

Neus gravatar image Neus
1415 14

Hi, I saw that sinze zk7.0 fileupload accepts html5 accept attribute but I can only find the documentation to implement it in a upload type button. I have a div where user can do a double click to select an image to upload. So on event Double Click of the Div I'm doing a Fileupload.get(). How can I indicate the accept attribute to this method??

Thank you!

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-03-18 11:16:37 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9

updated 2014-03-19 07:46:50 +0800

Well well,

Its a bug in Zk, they forget to put the accept tag in the zul-7.0.0.jar/web/zul/html/fileuploaddlg.zul

What can you do :

copy that zul to your project :

    <?xml version="1.0" encoding="UTF-8"?>

                The fileupload modal dialog

                Tue Jul 19 12:06:22     2005, Created by tomyeh

Copyright (C) 2005 Potix Corporation. All Rights Reserved.

        This program is distributed under LGPL Version 2.1 in the hope that
        it will be useful, but WITHOUT ANY WARRANTY.
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" ?>
<?page language="xul/html"?>
<?component name="uploaddlg" extends="window"
 class="org.zkoss.zul.impl.FileuploadDlg" widgetClass="zul.fud.FileuploadDlg"?>
<?component name="submit" extends="button" widgetClass="zul.fud.Submit"?>

<uploaddlg title="${arg.title}" uploadListener="${arg.listener}" shadow="false" border="normal" width="360px" closable="true"
        w:onClose="this.cancel()" w:max="${arg.max}">
        <label value="${arg.message}"/>
        <fileupload id="fileupload" forward="onUpload=" label="${c:l('mesg:org.zkoss.zul.mesg.MZul:UPLOAD_BROWSE')}"
                upload="zul.fud.ModalFileViewer, maxsize=${arg.maxsize}${arg['native'] ? ',native':''}"/>
        <separator bar="true"/>
        <div id="uploaded" visible="false"></div>
        <div id="btns">
        <submit id="submit" label="${c:l('mesg:org.zkoss.zul.mesg.MZul:UPLOAD_SUBMIT')}"
        <button label="${c:l('mesg:org.zkoss.zul.mesg.MZul:UPLOAD_CANCEL')}" w:onClick="this.$o().cancel(true)"/>

Customize it like you want it, (set your accept=audio/* for example in it)

and in your controller :


Greetz chill.

link publish delete flag offensive edit


It doesn't work to me

Neus ( 2014-03-18 15:02:42 +0800 )edit

I'll try and error myself tomorrow until I get it working:)

chillworld ( 2014-03-18 17:04:34 +0800 )edit

Thank you!

Neus ( 2014-03-18 17:05:08 +0800 )edit

Ok, I will try it thank you! But I have a doubt. If I change Fileupload template to only accept Images, all fileuploads of my application will use that template??

Neus ( 2014-03-19 08:13:35 +0800 )edit

BTW, I will post it as a bug

Neus ( 2014-03-19 08:15:15 +0800 )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: 2014-03-18 10:54:12 +0800

Seen: 22 times

Last updated: Mar 19 '14

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