-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3625371
By: nobody
hi, i am trying to upload a image to a tomcat server. however i can't copy the image to the dirctry that i want. can anyone help me with this.
there is my code
-----------------------------------
<window title="iframe demo" border="normal">
<iframe id="iframe" width="95%"/>
<separator bar="true"/>
<button label="Upload" onClick ="run()"/> <zscript>{ import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.swing.*; import java.io.*; import java.net.*; import javax.imageio.*;
void run(){
Object media = Fileupload.get();
if (media != null){
File file= new File(newimage.jpg);
ImageIO.write(media,"jpg",file);
iframe.setContent(media);
}else{
Messagebox.show("Error is pressed", "Error", Messagebox.OK, Messagebox.ERROR); } } } </zscript> </window>
---------------------------------------
error is class or vriable not found
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3625514
By: henrichen
Object media = Fileupload.get();
The media is a "com.potix.util.media.Media"; not a "java.awt.image.RenderedImage"
used in ImageIO.write().
Please check the JavaAPI of zul about Fileupload class and JavaAPI of pxcommon about Media for details.
http://zk1.sourceforge.net/javadoc/index.html
Also you can check the Fileupload demo source code.
/henri
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3625518
By: henrichen
BTW, it would be more convenient if you can copy the real error stack trace.
Thanks.
/henri
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3625799
By: nobody
hi thank you for ur reply, however i still got problem with it. I have checked java API, there is no write method under the com.potix.util.media.Media what i wanna is a client can loging to the page, and upload image to the server,( the server database is mysql) where i only wanna stort the location for the image, not the image(coverted into string) is there any method i can write the image to the dirctory that on the server?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3626094
By: henrichen
ZK is as thin as a presentation layer. Therefore, you have to handle the storage with java's io classes or database related classes. Since all code is running in server side, it is very easy to do whatever you want to do. (Think as if you are writing a desktop program)
What the Fileupload.get() (the uploaded image file) is a com.potix.image.AImage object (and a Media object).
AImage.getName() would give the filename while
AImage.getByteData() would give the raw data of the image (the file contents) as a byte[].
Then you use java.io.FileOutputStream to write the image raw data(the byte array) to whichever directory you like.
/henri
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3626154
By: nobody
that cool! i think i got it work, however i just look through the java api, there is a file copy method seems can do the same job and much easier. i wonder is that will be the same? i can simply copy the image over to the directory that i want. is their any tutorial for the file copy??? i don't really know how to reference the object to the inputstream.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3754923
By: nobody
Hi,
I have an application with an image,is it possible to change this image dynamically with for example a button browse?
thanks,
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3754952
By: henrichen
image.setSrc(imageurl);
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3755257
By: nobody
I don't understand how I can do this...
I do like this but it don't work:
<button label="test" onClick="image.setSrc(images/Entete_DessinAnaxagora.gif);"
/>
How Can I chose the position of my new image?
thanks,
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3755753
By: henrichen
<zk>
<image id="image"/>
<button label="test" onClick="image.setSrc(images/Entete_DessinAnaxagora.gif);"
/>
</zk>
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3755838
By: nobody
I have an error mesage when I click on the button.
My message is:
Sourced file: inline evaluation of :
''image.setSrc(image/Entete_DessinAnaxagor.gif);": Class or variable not found:
Entete_DessinAnaxagora.gif at line 1.
I don't know why it don't work
thanks
Asked: 2006-03-13 01:30:43 +0800
Seen: 394 times
Last updated: Jun 06 '13