Reputation: 14317
What do you suggest for location of images that the user uploads to my application?
in my server application (like WebContent->images) or in system location?
Upvotes: 3
Views: 3763
Reputation: 31371
You can map an external directory outside Tomcat within server.xml to store the images.
Use the <Context docBase="/some_path_on_your_machine">
tag for this.
If you use a database, it is recommended to store the path to the image in the database, and the actual image on filesystem.
See this thread What is the best place for storing uploaded images, SQL database or disk file system?
Upvotes: 4
Reputation: 2362
Store it outside the Tomcat installation. That makes updates of both Tomcat and your application a lot easier.
You could also think about storing the images as BLOB in a database.
Upvotes: 6