0

problems in the files uploaded

asked 2010-03-25 03:12:18 +0800

saprudin2009 gravatar image saprudin2009
30

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

delete flag offensive retag edit
Be the first one to reply this discussion!
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: 2010-03-25 03:12:18 +0800

Seen: 200 times

Last updated: Mar 25 '10

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