architecture - Where should I store photos? File system or the database? -
possible duplicate: storing uploaded photos , documents - filesystem vs database blob
i starting develop web app, primary purpose of display photos. users able upload photos well.
the first question came store photos: on file scheme or database.
i using windows box host site. database mysql , backend code in c# utilizing asp.net mvc.
filesystem, of course, unless you're aiming story on thedailywtf. easiest way have photos organized property can derive file itself, such sha-1 hash. store hash in database, attached photo's primary key , other attributes (who uploaded it, upload date, etc).
it's thought divvy photos on filesystem, don't end millions of files in single directory. you'll have this:
storage/00/e4/f56c0de1c61fdb926e79e8a0a65bd12930c9.jpg storage/25/9a/ec1c55bfb660548a6770238668c4b117d92f.jpg storage/5d/d5/4b01d98f17a9ad9dd1526b49ba39b5aa37a1.jpg storage/63/49/6f740b6c284ce6685dc17d473a7360ace249.jpg storage/b1/75/066d178188dde110149a8422ab651b0ee615.jpg storage/b1/20/a2b7d02b7b0c43530677ab06235382a37e20.jpg storage/da/39/a3ee5e6b4b0d3255bfef95601890afd80709.jpg
this easy port if ever move sharded storage.
architecture photos
No comments:
Post a Comment