File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Uploaded documents / images do not show up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Uploaded documents / images do not show up " Watch "Uploaded documents / images do not show up " New topic
Author

Uploaded documents / images do not show up

vandana chadha
Greenhorn

Joined: Dec 15, 2011
Posts: 1
In my Spring3Appliation, user can upload his picture. The uploaded picture does not show up on the view profile page. But if I restart Tomcat multiple times, it would show up, without any code changes.

I also tried to load the picture url in the browser directly, but that also gives a "is not available" error.

The images are in a folder which is at the same level as WEB-INF and not within WEB-INF

I have made the following property false: catalina.properties->tomcat.util.buf.StringCache.enabled, but no help.

Since even the browser does not show the image when directly loaded, I am assuming that it is a tomcat problem, and not the applicaton.

Sample urls being tried:
localhost:8080/tms/uploads/a.jpg
where tms is the context of the application

Please suggest.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15632
    
  15

Before you do anything else, move the upload directory.

You should never write into a deployed WAR. It's not supported by the J2EE standard, it won't even work on some servers and on servers like Tomcat where it (sometimes) does, you'll still end up in a lot of pain because updating the webapp can cause your uploaded data to be destroyed.

Always store uploaded files in a directory that is external to both Tomcat and the WARs.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Uploaded documents / images do not show up
 
Similar Threads
images don't appear outside local machine
Problem with Tomcat 5.5
how to install tomcat 5.5 in windows vista
<img> tag not showing the image
JSP with CSS does not display the background image