• Post Reply Bookmark Topic Watch Topic
  • New Topic

After restart tomcat all uploaded files deleted  RSS feed

 
Anast Gorobets
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I uploaded my files:


I stored my files in webapp/images. But when the app is redeployed the uploaded files are also getting deleted. How can I solve this problem? When I upload in C:/apache-tomcat-8.0.18/uploads/images/ I can't get images in my jsp , get error Not allowed to load local resource
 
Stefan Evans
Bartender
Posts: 1836
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your solution of storing your files outside of your deployed web application is the correct one.
If you store them within the web app directory, it gets deleted on redploy (as you have noted)

That then raises the question - well how do you access them again?
And the answer to that is: with another servlet.
One that would do the opposite of the one you have written here - read the file from disk, and stream it out on the Servlet response output stream

Like this for example

cheers,
Stefan
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!