I have created an upload form to upload some images.The server is Tomcat and I am using eclipse to develop the JSP. During the upload the images in the form are store on different drive than what the server is running on.
After uploading, I tried to use a JSP which uses the images.In the JSP, I have specified the absolute path for the image. I am able to see the images on the eclipse internal browser.But when I use Firefox I cannot see the images. What could be wrong.Is it because the images are not in WEB-INF.?
I dont think this can be a reason. If this is the reason, you shouldn't have seen them in the eclipse internal browser as well.
During the upload the images in the form are store on different drive than what the server is running on.
Please be clear. I couldn't understand, what you mean to say. [ May 23, 2008: Message edited by: Prasad Tamirisa ]
Joined: Apr 26, 2008
Hi There, I have installed tomcat in C drive and the during the image directory is in D drive. In eclipse when I select...run as->run on server...i can see the images on the eclipse internal browser.But when I copy the same url onto Firefox..I can see only the text but not images.Note in the jsp I have given the complete path for the image.
Did you enter a path with a drive name, like "d:/myimages/img1.jpg"? If that is the case, your remote users will not be able to see the pictures. They are only visible on a browser running on the server. You have to make sure that the pictures are served via your web server. Putting them under web-inf can help. You have to use a relative path in that case.
example: pictures in web-inf/images , than your path could be /images/img1.jpg"
OCUP UML fundamental and ITIL foundation
Joined: Mar 22, 2005
Originally posted by Jan Cumps: You have to make sure that the pictures are served via your web server. Putting them under web-inf can help.
Actually, putting them under WEB-INF ensures that nobody can see them, because nothing gets served directly out of that directory. The images need to be in a publicly accessible directory, like the one WEB-INF itself is in. [ May 23, 2008: Message edited by: Ulf Dittmer ]
True. My mistake. I ment to say in a subdir of the application root.
Joined: Apr 26, 2008
Thanks for the reply.Yep I am using absolute path like "d:\\images\image.jpg".
I have the eclipse workspace in different folder path than tomcat ie my application is in d:\\workspace\\website and tomcat is installed in c drive.
While reading from the form if I start dumping the images into d:\\workspace\\website\\WebContent\images\\ will it work?I am quite doubtful that eclipse will be able to detect the dynamic changes taking place in the image directory and sync with the server instance.Is there a folder in tomcat that I can put the images?. Cheers. Sam
Originally posted by sam barker: Thanks for the reply.Yep I am using absolute path like "d:\\images\image.jpg".
When you use an absolute path in an image tag like that, you're telling the user's browser to go the the image file from that location. Unless the user has a file named 'image.jpg' in his/her "d:\\images" directory, they will never be able to see it.