In my web application which I use primefaces+SpringWebflow. I need to add a picture which is scanned or uploaded to every customer registered. I can not think of any good solution to store the files. Criteria is that. I want only application have access to files and it shouldnt be possible to access the images directly. I tried to store the files in database but thats not good idea. i store the path in database. I would like to have relative paths to files. and efficient wy to access the file.
2 Answers
Just store the files in the database. If you try to put them somewhere else, it will be difficult to migrate your application from one server to another, because its data will be spread across multiple sources. Upgrades will be more difficult.
If performance / database size becomes an issue, revisit this decision, but make sure you always measure rather than guess the performance.
4 Comments
Why is it not a good idea to store the files in DB ? What will happen when you deploy your application on a clustered server environment ? In clustered server environment your solution of keeping images on file-system will not work. You need to think more on keeping storage of images in DB in mind. Just investigate what performance hit you are getting in storage/retrieval of images in DB. try different kind of storage frameworks like nosql DBs. Essentially you can not get away with storing data at a central location I think.