aspose file tools*
The moose likes Servlets and the fly likes File Upload in Tomcat 7- Uploaded files are deleted automatically after redeploying the application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "File Upload in Tomcat 7- Uploaded files are deleted automatically after redeploying the application" Watch "File Upload in Tomcat 7- Uploaded files are deleted automatically after redeploying the application" New topic
Author

File Upload in Tomcat 7- Uploaded files are deleted automatically after redeploying the application

Sandeep Panda
Greenhorn

Joined: Nov 07, 2011
Posts: 8

Hi

I am using Servlet 3.0 and MultipartConfig annotation(Using Parts) to upload files. The upload Servlet works perfectly but as soon as the app is redeployed the uploaded files are also getting deleted. I am storing the uploaded files in /WEB-INF/uploads directory of the web app. Please let me know why the files are getting deleted after redeploying the app.

Any suggestions will be highly appreciated.

Regards!
Koen Aerts
Ranch Hand

Joined: Feb 07, 2012
Posts: 344

You should never upload files to the web work folder. Files should be uploaded outside of the web app location.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

Why you should be surprised that when you redeploy the web app, the files are replaced? Anything in the web app is removed and replaced with the new deployment.

As has already been pointed out a number of times in the past week (you really should be reading all posts in this forum) never stored files inside the web app.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sandeep Panda
Greenhorn

Joined: Nov 07, 2011
Posts: 8

Oh my bad..I got it..it is such a common concept..
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Keep in mind of the fact that during deployment your WAR file gets extracted afresh if not done.


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File Upload in Tomcat 7- Uploaded files are deleted automatically after redeploying the application