0

more fileupload customizations

asked 2007-10-09 23:14:30 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4561106

By: hlezmana

hi,

Wondering if anyone can help me customizing fileupload so that the upload button says "Some text" rather than "Upload". In addition, I need the fileupload dialog window to accept only excel files.

I am trying to create a window that takes 2 excel files, then perform some calculation on the 2 excel files which then produces another excel file (in the form of file download). So essentially speaking combining the fileupload component and filedownload component to one single button. Is that doable?

Is it possible to mimic the Fileupload component using a regular button and a couple <input> elements? I was looking at the UploadEvent but couldn't figure out how i could fire that off manually. In addition i don't know how to construct the underlying media object from a filepath.

Any suggestion?

Thanks,
Akin





delete flag offensive retag edit

20 Replies

Sort by » oldest newest

answered 2007-10-10 07:49:53 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4561438

By: jebberwocky

Dear Akin

To contruct a media object from a filepath:

java.io.InputStream is = desktop.getWebApp().getResourceAsStream("/me.pdf");
Media = new AMedia(FILE_NAME, null, "application/pdf", is)

for the AMedia's constructor, please refer to zcommons javadoc http://www.zkoss.org/javadoc/3.0.0-RC/zcommon/

//Jeff

link publish delete flag offensive edit

answered 2007-10-10 09:40:28 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4561543

By: sousa1981

"Wondering if anyone can help me customizing fileupload so that the upload button says "Some text" rather than "Upload". In addition, I need the fileupload dialog window to accept only excel files."

Try:
Fileupload fu = new Fileupload();
fu.setTemplate("/zul/fileupload.zul");
Media[] aux_ficheiros = fu.get("only excel", "my App", MAX_FILEUPLOAD_SIZE); if (aux_ficheiros != null) {
for (int i = 0; i < aux_ficheiros.length; ++i) {
if (isAllowed_extensions(getExtension(aux_ficheiros[i].getName())) {
// Process File
}
}
}

Where "/zul/fileupload.zul" is an template that you copied from ZK Src file and modified the test "Upload" to "Some text" and that template is in your WebRoot "/zul/fileupload.zul"

Hope this help,

Marcos de Sousa

link publish delete flag offensive edit

answered 2007-10-10 14:50:22 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4561980

By: hlezmana

Thanks so much, i'll try those.

I am still having trouble looking up the template file "/zul/fileupload.zul".
I browsed most of the folders in SVN. Couldn't find a file named fileupload.zul.

Akin

link publish delete flag offensive edit

answered 2007-10-10 15:14:50 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4562034

By: sousa1981

On the SRC "zk-src-3.0.0-FL-2007-09-28"

Go to:\zk-src-3.0.0-FL-2007-09-28\zul\src\archive\web\zul\html

There is an fileuploaddlg.zul or something related.

Remember that the modification of fileupload will not working if u change version of zk.
To work, u must update the template according the version of zk (go to src and get the template version).

I use the fileupload.zul template, because I wanted to customize the template in size, height on version 2.4.1, in version 3, maybe it had been corrected, and I haven't an fileupload on version 3 in production.

Regards,

Marcos de Sousa




link publish delete flag offensive edit

answered 2007-10-10 15:17:35 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4562040

By: sousa1981

You will have success, if you in addition, read the documentation (see the javadoc and pdf) about upload and download.

Because my information maybe be incorrect.

Regards,

Marcos de Sousa


link publish delete flag offensive edit

answered 2007-10-10 16:23:26 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4562154

By: hlezmana

Thanks again Marcos,

the fileuploaddlg.zul uses fileuploaddlg.dsp.

the following line seems to be the line that i need to change in fileuploaddlg.dsp:
<input type="submit" value="${c:l('mesg:org.zkoss.zul.mesg.MZul:UPLOAD_SUBMIT')}"
onclick="parent.zk.progress()"/>

Is there any tutorial on modifying/building/deploying/maintaining such DSP file?

Akin

link publish delete flag offensive edit

answered 2007-10-11 07:05:46 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4563213

By: sousa1981

You dont need to modify the DSP file, read the documentation how to customize the fileupload.

Regards,

Marcos de Sousa

link publish delete flag offensive edit

answered 2010-02-08 22:52:40 +0800

by020827 gravatar image by020827
6

dear all:
I have a question.
how to get "ture file" into my customize's folder space.

ex:
client upload a file [name=hello.xls] into this folder↓
C:\upload

how can i get file in C:\upload
if use Reader , i got Error message : use getByteData() instead .

please help me

link publish delete flag offensive edit

answered 2010-02-11 19:49:13 +0800

iantsai gravatar image iantsai
2755 1

uh... first I'm not sure if this problem is a ZK problem.
But anyway, it's no really a big deal, the real problem is: Second, this is a very old post which seems has no relation to your problem, you should shoot a new post.

link publish delete flag offensive edit

answered 2010-02-13 00:35:19 +0800

by020827 gravatar image by020827
6

ok...thank you

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: 2007-10-09 23:14:30 +0800

Seen: 2,363 times

Last updated: Mar 21 '10

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