Database: image file as blob or file path?

后端 未结 3 654
北荒
北荒 2021-01-20 23:54

I know this question has been asked any a times.

I read this whole post but still couldn\'t reach to a point.

I am making a website which will allow users to do

3条回答
  •  清歌不尽
    2021-01-21 00:31

    it really depends on what you're doing.

    if you use file paths, then you have to have different and consistent security setup on that path. you also have to do something to enforce unique filenames, etc. you also need to set up backup for that directory as well

    if you use blobs, the database handles security for you, backup should be consistent with everything else in the db.

    you might store them as blobs in a different table, with a FK from the first table to the blob table. then you can avoid storing the same blob multiple times, etc.

提交回复
热议问题