2

I am using Spring framework MultipartFile to upload files using my application to the server, though whenever I do any 'Project > Clean' from Eclipse STS, all files I've uploaded earlier get deleted automatically.

I am saving all files uploaded to the following path:

String rootPath = request.getSession().getServletContext().getRealPath("contentrepository");

Which in real path get translated to:

C:\springsource\apache-tomcat-7.0.40\webapps\myapp\contentrepository\

so can someone please tell me what I am doing wrong here to cause those files to get deleted each time I do a Porject > Clean? Is it that STS clean command empty the webapps folder content? Shall I change the upload files folder location to another locations outside the apache folder totally?

Thanks or your time

MChan
  • 6,842
  • 27
  • 83
  • 132

1 Answers1

2

Spring Multipart upload has nothing to do with your problem! Whenever you clean your project, all deployed directories will be cleaned. Similarly, when you deploy your project, complied files will be deployed to server. When you upload a file, it is save in your deployed location, however on cleaning all the data is lost.

If you want to persist file during your testing i.e want to have files even if you clean your project: - Store uploaded file to some other location. OR - Take backup of uploaded files before you clean your project and copy them to deployed folder.

You might like to view this question, for what exactly 'clean' does.

Community
  • 1
  • 1
Sudarshan_SMD
  • 2,549
  • 33
  • 23
  • I don't understand why you link a question relative to visual studio? – F. Geraerts Aug 29 '13 at 12:18
  • If I am not wrong, 'Clean', 'Build' and 'Clean and Build' work similarly across different IDEs. I linked the question so that, OP can understand what 'Clean', 'Build' and 'Clean and Build' does. Only difference is in names. 'Clean and Build' in Eclipse is referred as 'Rebuild' in Visual Studio. I hope my linking of question related to different IDE did not confuse the OP. – Sudarshan_SMD Aug 30 '13 at 05:35