0

3.6.x fileupload in zk5?

asked 2009-11-04 09:30:39 +0800

cmd gravatar image cmd
69 1

the demo code "fileupload" in zk 3.6.x is bad in zk 5.0rc and how to rewrite?
---not the version in the smalltalk http://docs.zkoss.org/wiki/ZK_5:_New_File_Upload
i want use it by default zkdemo.
thanks.

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2009-11-04 11:43:08 +0800

YamilBracho gravatar image YamilBracho
1722 2

They arte different. In ZK5, fileupload is an attribute of a component so you can use any component to get the fileupload dialog. In ZK 3.6.x is is a separate component.
The demo code is:

<zk>
	<button label="Upload">
	<attribute name="onClick">{
		org.zkoss.util.media.Media[] media = Fileupload.get(-1);
		if (media != null) {
			for (int i = 0; i < media.length; i++) {
				if (media<i > instanceof org.zkoss.image.Image) {
					org.zkoss.zul.Image image = new org.zkoss.zul.Image();
					image.setContent(media<i >);
					image.setParent(pics);
				} else {
					Messagebox.show("Not an image: "+media<i >, "Error", Messagebox.OK, Messagebox.ERROR);
					break; //not to show too many errors
				}
			}
		}
	}</attribute>
	</button>
	<vbox id="pics" />
</zk>
			

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2009-11-04 09:30:39 +0800

Seen: 357 times

Last updated: Nov 04 '09

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