Dejell
Dejell

Reputation: 14317

where to store uploaded images - in the tomcat application or on the server?

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

Answers (2)

JoseK
JoseK

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

Olvagor
Olvagor

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

Related Questions