1

I have spring webapp in maven and users can upload files which are being saved in the tomcat folder, since I use tomcat as the webserver. I have some jsp and html pages, so what is the path to those files uploaded on tomcat server? I guess I don't want to use absolute path on my computer to tomcat folder. And would something change regarding paths, if the app is published on internet on actual server?

wdc
  • 2,623
  • 1
  • 28
  • 41
  • 1
    you dont want to use absolute paths. if user deploys your app on another url with another name, your path will change. instead use relative paths within your project. – Tuncay Göncüoğlu Aug 13 '17 at 11:57
  • @TuncayGöncüoğlu Thanks for the answer. So how would I specify path from my controller in src/main/java/controller to webapp folder? – wdc Aug 13 '17 at 12:19
  • Read Xavier Bouclet's answer, especially the linked best practices. And *do not* save uploaded files in the `webapps` folder (reasons given in the linked answer). – Olaf Kock Aug 14 '17 at 04:26

1 Answers1

2

It's where you want to save it.

See this link to find more information about the best practices

Xavier Bouclet
  • 922
  • 2
  • 10
  • 23