• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

After restart tomcat all uploaded files deleted

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 1845
10
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic