Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

save image in database or in server directory

 
simon tifo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a field image in my product table and class and I 'd like to ask you which is better : save the image in the database or in one directory in the server

if the second case is the best, please explain me more how to manage it (I never had the opportunity to meet this case)
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18162
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
People argue over that. It depends on a lot of things. There's no "right or wrong", just what works best for you.

When you upload an (image) file, the data is stored in the server in a local cache where it can be accessed as an input stream. Your application code can then copy the data stream to a database BLOB or it can create a file on the server's filesystem and copy the data into that file. The file can be located anywhere you wish, as long as you don't copy it into your WAR's directories or into the webapp server's directories.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic