The platform isn't really as important as the theory. For the record, it is ASP.NET (C# on 3.5 SP1), SQL Server 2005. For the sake of argument, I have unlimited space (filesystem and database) and unlimited bandwidth.
I am working on a project that would allow multiple users to upload their own images which could be managed by that user and viewed by all users. I am trying to determine what the best storage mechanism is. My line of thought is that I would want to avoid storing them in the database directly, although I could see storing information about the images.
What I am seeing is that the user would upload the image. The server would create a unique name for the image, store it to the filesystem, and store the relational data about that image in the database (i.e. when it was uploaded, the association to the user, reference to a caption, etc.). Having these on disk is one step towards being able to move to a CDN in the future.
Has anyone used an approach like this or could recommend a different approach? Should there be some sort of a folder structure, such as a folder for each user to help file access times?
Any feedback would be appreciated!