C:\Documents and settings\images\myimage.jpg in my upload servlet I try to read the image String pp = "C:\Documents and settings\images\myimage.jpg"; InputSttream ins = getServletContext().getResourceAsStream(pp); ins is null what shoud be the problem
The path must begin with a "/" and is interpreted as relative to the current context root.You can't use that method to get a file, unless that file exists under the context root of the servlet, use a normal FileInputStream and replace "\" with either "/" or "\\".
String path="C:\\Documents and Settings\\images\\myImage.jpg"; InputStream ins = this.getClass().getResourceAsStream(path); but ins = null; InputStream ins = this.getClass().getResourceAsStream("/"+myImage.jpg); but ins = null; what shoud be the problrm
can only be used for something in the "context root" (when accessed through a ServletContext) or something in the classpath when accessed through Class.
As I said in my first post.
InputStream ins = new FileInputStream(path);