File Upload
From Documentation
This documentation is for an older version of ZK. For the latest one, please click here.
The file upload dialog is no longer applicable. Rather, you shall use Button or Toolbarbutton with upload="true" instead. For example,
<zk>
<zscript>
void upload(Event event) {
org.zkoss.util.media.Media media = event.getMedia();
if (media instanceof org.zkoss.image.Image) {
org.zkoss.zul.Image image = new org.zkoss.zul.Image();
image.setContent(media);
image.setParent(pics);
} else {
Messagebox.show("Not an image: "+media, "Error", Messagebox.OK, Messagebox.ERROR);
break; //not to show too many errors
}
}
</zscript>
<button label="Upload" upload="true" onUpload="upload(event)"/>
<toolbarbutton label="Upload" upload="true" onUpload="upload(event)"/>
<vbox id="pics" />
</zk>
If you prefer to use a dialog (Fileupload.get()), please take a look at ZK Component Reference: Fileupload for more inormation.