I'll try and error myself tomorrow until I get it working:)
chillworld ( 2014-03-18 17:04:34 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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!
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"?>
<!--
fileuploaddlg.zul
Purpose:
The fileupload modal dialog
Description:
History:
Tue Jul 19 12:06:22 2005, Created by tomyeh
Copyright (C) 2005 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
This program is distributed under LGPL Version 2.1 in the hope that
it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
-->
<?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"
xmlns:w="http://www.zkoss.org/2005/zk/client"
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')}"
w:onClick="this.submit()"/>
<button label="${c:l('mesg:org.zkoss.zul.mesg.MZul:UPLOAD_CANCEL')}" w:onClick="this.$o().cancel(true)"/>
</div>
</uploaddlg>
Customize it like you want it, (set your accept=audio/* for example in it)
and in your controller :
Fileupload.setTemplate("fileuplaodTemplate.zul");
Fileupload.get();
Greetz chill.
I'll try and error myself tomorrow until I get it working:)
chillworld ( 2014-03-18 17:04:34 +0800 )editAsked: 2014-03-18 10:54:12 +0800
Seen: 28 times
Last updated: Mar 19 '14