0

I'm working on a spring project and I want to store images that users upload.

From what I understood/read, it's not possible to write in to WAR files as they are read-only. Therefore it's not possible to create a new file in the Resources folder of this web app when it's deployed on the server as a WAR file.

If this is true, where should the app write these files to ? considering the fact that directory hieracrchy for different machines (i.e. the servers which this web app is going to be deployed to) are different.

I'm confused, what is the best approach here ?

Arian
  • 7,397
  • 21
  • 89
  • 177
  • the directory structure should not be too different between the stages. if they were different they do not really serve a good testing purpose if they do not actually reflect the live environment. generally you should either specify a storage location like /opt/lalala/images or get some configuration that is different on each stage that specifies that "imageFolder" is supposed to be /a/b/c/... one on stage but /d/e/f on another. In particular image hosting can easily be done using AWS S3 for example, in that case you would specify different accounts and credentials for each stage. – luk2302 Aug 13 '17 at 23:33
  • Put the folder name in a .properties file, and read that for the path. – OldProgrammer Aug 13 '17 at 23:35

0 Answers0