-
FEATURED COMPONENTS
First time here? Check out the FAQ!
have upload image files to the server at my application, the file is saved in the folder "images" and checked there ..., but when I call the file in a browser that does not exist, I have to restart tomcatnya first, and only files that can arise. How do I upload the results can be instantly displayed, with image.setSource ( "images /" + nama_file) not image.setContent (media).
Save file to path:
I call this function:
public void saveToDisk(org.zkoss.util.media.Media media) throws Exception {
String path = "F:/Padicon/datacenter/datacenter/WebContent/page/menu/images/"+ media.getName();
File f = new File(media.getName());
FileOutputStream fos = new FileOutputStream(new File(path));
fos.write(media.getByteData());
fos.close();
System.out.println("Image Save to "+path);
}
and then I write script
image.setSrc("images/"+media.getName()); //File not found, but if I restart my tomcat, file founded
image.setParent(pics); //vbox pics
Asked: 2010-03-25 03:12:18 +0800
Seen: 200 times
Last updated: Mar 25 '10