Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 files in future, can you recommend is it best to have the files uploaded to the filesystem (and link to it via the database) or upload to the database directly as a BLOB?

Thanks for any help. Dan

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
693 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...