I have a website where users sign up and get to upload their images and videos for their portfolio. Each user is shown under some criteria and when visitors click on their names they see the portfolio.
My question is: which is better, having folders for each user (upon signing up creating folders with unique_id of their name or some sort) so that they can upload their images and videos in there or renaming the uploaded files and putting everything in one folder. Or store the images straight in database with binary blob conversion?
From a performance perspective I would think that having a directory per user is better. The max limitation of directories on NTFS partitions seems to be over 4 billion which should be more than enough for any app.
If you use Linux/Unix, the max # of folders you can have will vary on the type of partition as well but if NTF’s limit is big enough, I imagine ext3 or any of the journalised file systems should have an ample limit as well.
Regarding whether is better to store images on the DB or the file system, other people have pointed out a well-known related question here. My take is that, generally, either solution works good and both have pros and cons as to make the decision ultimately pretty much a matter of taste.