-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Well,
Always doing great staff.
Without words to tell how cool it is.
Cheers,
Multiple selection will be supported in the later version, but it requires Flash (not just pure HTML+JavaScript).
However, it might not be a good idea to upload all files simultaneously since it will have some performance impact to the server (network traffic).
BTW, the browser has the limitation about how many connections can be made to the same server. So, uploading multiple files at the same time requires Flash (or other plugin), too.
It is a ZK5 version.
I have trouble to make this work with only java. How can I save the files uploaded and I can't get the image.setContent(event.getMedia()) working. Also every image I upload is rejected as image (if (media instanceof org.zkoss.zul.Image)). Can somebody tell me what I did wrong
zulfile:
----
<?xml version="1.0" encoding="UTF-8"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="win2" title="upload" border="normal" apply="control.w2Controller">
<fileupload id="upl" label="Attach" upload="true" />
<image id="img" />
</window>
</zk>
javafile:
----
package control;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.UploadEvent;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Fileupload;
import org.zkoss.zul.Window;
import org.zkoss.zul.Image;
public class w2Controller extends GenericForwardComposer
{
private Image img;
private Fileupload upl;
@Override
public void doAfterCompose(Component win) throws Exception
{
super.doAfterCompose(win);
((Window)self).setTitle("init");
}
public void onUpload$upl(UploadEvent event) throws InterruptedException
{
((Window)self).setTitle("uploaded");
Object media = event.getMedia();
if (media instanceof org.zkoss.zul.Image) // <- never true, even as image???
{
//img.setContent(media); // <-- this will not compile
}
else
{
alert("not an image");
((Window)self).setTitle("uploaded -> not an image");
}
}
}