开发者

How to store files or images on the file system?

开发者 https://www.devze.com 2022-12-22 08:10 出处:网络
I am working on project -online file management where we have to tore file and images.so we are in confusion state that whethe开发者_运维技巧r we use file system or database to store file and images;;

I am working on project -online file management where we have to tore file and images.so we are in confusion state that whethe开发者_运维技巧r we use file system or database to store file and images;;;;;


An usual approach is to store big binary data (e.g. images) in files, and put pointers to them in a database. This way the best of both worlds can be combined (to a degree, at least); file system's efficiency of file storage, and database's search / sort / lookup capabilities.


Keep your files out of the database. Create a record in the database like so:

 primaryKey   FileName    FileDescription     OnDiskKeyName 
 ------------ ----------- ------------------- -----------------

use a UUID to give a unique name to the file, and a link to the database with a human-readable name.

0

精彩评论

暂无评论...
验证码 换一张
取 消