manage uploaded files in database or file system?

前端 未结 2 1569
甜味超标
甜味超标 2020-12-21 06:25

I\'m going to incorporate the feature for my users to upload small files which are under 2mb (jpg, gif, pdf and docs). For page loading times purposes and generally managing

2条回答
  •  余生分开走
    2020-12-21 06:44

    From my point of view, file system is the best choice.

    1. Your database is not getting oversized because of BLOB fields
    2. You store only filenames as strings and you possibly can index on them (if you give meaningful names to your files)
    3. If you run out of space it is much easier to plug new HDD than migrate your DB.

    The only drawback here is that someone (even you) can accidentally delete files much easier than BLOB fields.

提交回复
热议问题