works not
but the main problem I wanto to change the retrived absolute path
the my files on the server my web hoster
in back end I becom the the path of the context
String p=request.getSession().getServletContext().getRealPath("/")+"tempData"+java.io.File.separator;
I want to use the path in javascript
how to maniputate tha path to use it in javascript
thanks
Java runs on the server.
Any file I/O you do in java happens on the server.
You can not write files to the client computer in code. To do so would be a security hole.
The best you can do is send the file to the person, and prompt them to save it. They then choose where they want to save it.
the problem isnot so as you did understand
Problem description
I have web application clients users upload images I read the images from the request Object and I save it in a folder "tempData" in the web application
myApp/ tempData
after upload user will see their uploaded images to check
I try to display the uploaded images in browser using relative path
notice local on my home pc works fine
but by my web hoster images can not be displayed an I am sure it is a path problem
meine question how can I use the absoulute path in javascript to find
the uploaded images
thanks
The image is saved on the server in the
/myApp/tempData folder?
So you would request it to the client browser with the url:
http://www.myServer.com/myApp/tempData/imageName.jpg
specifying a url of "c:\tomcat..." tells the browser to look for the image on your local machine - NOT on the server. Which is probably why it works on your home pc, as your server and client are the same machine.