0

Why is it error?

asked 2006-05-22 10:51:48 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: joken2006

Media media = (Media) Fileupload.get();
InputStream ipuStm = (InputStream)media.getStreamData();
String outfn = "d:\\netdisk\\zktest\\a.jpg";
try {
FileOutputStream output = new FileOutputStream(outfn);
byte[] buf = new byte[1024];
int count;
count = ipuStm.read(buf, 0, 1);
while(count!=-1){
output.write(buf,0,count);
count = ipuStm.read(buf,0,count);
}
output.flush();
ipuStm.close();
output.close();
System.out.println("File copy sucessfully!");

} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


delete flag offensive retag edit

11 Replies

Sort by » oldest newest

answered 2006-05-22 11:13:45 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: tomyeh

What is the error?

link publish delete flag offensive edit

answered 2006-05-23 01:15:05 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: nobody

The error is :

[B@13f8d12
image/jpeg
12 2006-5-23 9:13:39 com.potix.zk.ui.sys.PageImpl interpret:416
a﹐¥e??: >>bsh.TargetError: Sourced file: inline evaluation of: `` {
filewin.upload(); } ;'' : Method Invocation filewin.upload
>>java.lang.IllegalStateException
>> at com.potix.image.AImage.getStreamData(AImage.java:165)
>> at com.uit.netdisk.zk.fileOperate.FileManagerWindow.upload(FileManagerWindow.
java:263)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at bsh.Reflect.invokeMethod(Unknown Source)
>> at bsh.Reflect.invokeObjectMethod(Unknown Source)

13 2006-5-23 9:13:39 com.potix.zk.ui.sys.UiEngineImpl resumeAll:628
a﹐¥e??: Unable to resume [Event processing thread: event=null, ceased=false] java.lang.IllegalStateException
at com.potix.image.AImage.getStreamData(AImage.java:165)
at com.uit.netdisk.zk.fileOperate.FileManagerWindow.upload(FileManagerWindow.ja
va:263)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at bsh.Reflect.invokeMethod(Unknown Source)
at bsh.Reflect.invokeObjectMethod(Unknown Source)
at bsh.Name.invokeMethod(Unknown Source)
at bsh.BSHMethodInvocation.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at com.potix.zk.ui.sys.PageImpl.interpret(PageImpl.java:409)
at com.potix.zk.ui.sys.EventProcessingThread.process0(EventProcessingThread.jav
a:359)
at com.potix.zk.ui.sys.EventProcessingThread.run(EventProcessingThread.java:274
)

link publish delete flag offensive edit

answered 2006-05-23 01:23:28 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: tomyeh

Use getByteData instead because it is in memory (inMemory returns true).

I'll wrap an input stream on top of the binary array for getStreamData, but have to wait for next nightly.

link publish delete flag offensive edit

answered 2006-05-23 02:19:44 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: nobody

Can you tell me How do I will be to that I can save the file from
Fileupload.get()

link publish delete flag offensive edit

answered 2006-05-23 02:27:57 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: tomyeh

Change getStreamData with

InputStream ipuStm = new ByteArrayInputStream(media.getByteData());

link publish delete flag offensive edit

answered 2006-05-23 06:21:42 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: nobody

Thank you very much!
How can I get file size from Fileupload.get()?


link publish delete flag offensive edit

answered 2006-05-24 06:09:55 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: henrichen

How about media.getByteData().length?

/henri

link publish delete flag offensive edit

answered 2006-05-24 07:30:25 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: joken2006

Yes,it's right to get file size.
but when i upload a file (The File type isn't wma or jpg). the following error is encountered .is causing it. not sure why? thanks for the help.
--------------------------------------------------
13 2006-5-24 15:24:45 com.potix.zk.ui.sys.PageImpl interpret:416
a﹐¥e??: >>bsh.TargetError: Sourced file: inline evaluation of: `` {
filewin.upload(); } ;'' : Method Invocation filewin.upload
>>java.lang.IllegalStateException
>> at com.potix.util.media.AMedia.getByteData(AMedia.java:153)
>> at com.uit.netdisk.zk.fileOperate.FileManagerWindow.upload(FileManagerWindow.
java:407)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at bsh.Reflect.invokeMethod(Unknown Source)
>> at bsh.Reflect.invokeObjectMethod(Unknown Source)

12 2006-5-24 15:24:45 com.potix.zk.ui.sys.UiEngineImpl resumeAll:628
a﹐¥e??: Unable to resume [Event processing thread: event=null, ceased=false] java.lang.IllegalStateException
at com.potix.util.media.AMedia.getByteData(AMedia.java:153)
at com.uit.netdisk.zk.fileOperate.FileManagerWindow.upload(FileManagerWindow.ja
va:407)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at bsh.Reflect.invokeMethod(Unknown Source)
at bsh.Reflect.invokeObjectMethod(Unknown Source)
at bsh.Name.invokeMethod(Unknown Source)
at bsh.BSHMethodInvocation.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at com.potix.zk.ui.sys.PageImpl.interpret(PageImpl.java:409)
at com.potix.zk.ui.sys.EventProcessingThread.process0(EventProcessingThread.jav
a:359)
at com.potix.zk.ui.sys.EventProcessingThread.run(EventProcessingThread.java:274
)

link publish delete flag offensive edit

answered 2006-05-24 08:32:15 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: nobody

Thank you,The problem has been solved.
but i upload a file that size is bigger than 5M,It caus error:
the request was rejected because it's size exceeds allowed range

What should i do?




link publish delete flag offensive edit

answered 2006-05-24 15:27:40 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

By: tomyeh

Search the developer's guide for max-upload-size.

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: 2006-05-22 10:51:48 +0800

Seen: 437 times

Last updated: Apr 23 '11

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