-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I would like to ask if we can get the file binary from XHtml input tag in zscript????
e.g.
<zk>
<window title="File Upload" border="normal" xmlns:h="http://www.w3.org/1999/xhtml">
<h:input id="fileUpload" type="file" />
<button label="Test">
<attribute name="onClick">
// Get the file binary from fileUpload control
// ....
</attribute>
</button>
</window>
</zk>
I know that we can use FileUpload control instead. But I got an error when Upload button in FileUpload control is clicked.
Error message:
org.apache.commons.fileupload.servlet.ServletFileUpload.setProgressListener(Lorg/apache/commons/fileupload/ProgressListener;)V
My situation is quite complicated. The zul page is put inside a iframe which is belongs to a porlet in a Portal page. The FileUpload control is worked fine in the zul page alone but not inside the iframe of the porlet.
So I would like to find a workaround for file uploading.
I'm using ZK 3.6.2.
Thanks.
what is the exception stack trace?
Only the following text is shown after I browsed the file and clicked the Upload button.
org.apache.commons.fileupload.servlet.ServletFileUpload.setProgressListener(Lorg/apache/commons/fileupload/ProgressListener;)V
This text is shown before the Cancel button and after the text [Specify a file located in your local system]. (And the Upload button is disappeared)
I tried to try .... catch .... if any exception is thrown and nothing is caught.
Also, nothing is logged in the Portal page log.
Are there any other way to log the exception stack????
I don't think you can use this kind of way to get a file upload form a HTML input with type "file"
ZK didn't do any thing in this case, it's PURE HTML way, I guess.
and
in onClick, you tried to get the binary data , I didn't see how you get it, did you call fileUpload.getWhat()??
Let me summarize my questions again.
What I want to do is to get the file binary from client side.
1) I tried use FileUpload control in ZK, but the FileUpload control throw error when Upload button is clicked.
Error message:
org.apache.commons.fileupload.servlet.ServletFileUpload.setProgressListener(Lorg/apache/commons/fileupload/ProgressListener;)V
The error message is just shown at the UI and I cannot find any exception stack. (The error only thrown in my Portal page but just fine in normal webpage)
2) Then, I want to find if any workaround existed to get the file binary. (This is my first question)
I tried to write the sample code:
<zk>
<window title="File Upload" border="normal" xmlns:h="http://www.w3.org/1999/xhtml">
<h:input id="fileUpload" type="file" />
<button label="Test">
<attribute name="onClick">
// Get the file binary from fileUpload control
// ....
</attribute>
</button>
</window>
</zk>
But I don't know if ZK is able to get the file binary from the pure xhtml control. (i.e. I don't know what function should be called in the onClick function of the Test button)
So, my questions are:
1) Does anyone know what's wrong with the FileUpload control for my case???? What can I do to get the exception stack.
2) Is there any workaround for file upload???? e.g. get the file binary directly from xhtml
Thanks a lot.
then I guess you are using a version of apache commons which is too old to run with zk.
you could update this jar to newer, or use the jar in zk-bin release directly.
jar name is commons-fileupload.jar
Thanks for your prompt response.
I have tried changing the commons-fileupload.jar, even download the latest version (1.2.1) from the official site and the error still occurred.
And may I ask you a question about Java. Is there any method we can trace the class that is loaded from which jar file or class file? I suspected this issue may be due to another old jar file containing the classes inside commons-fileupload.jar....
HI, have similiar problem problem with file upload , I was using button with upload =true , everything is fine in our local network, but it raises render exception when we are using vpn
I thing we are trying to find pure html solution. Any body knows how?
Asked: 2009-07-08 06:32:48 +0800
Seen: 625 times
Last updated: Sep 22 '11