Reputation: 65
Upvotes: 2
Views: 9064
Reputation: 98
Its common for companies to opt for 3rd party's or separate storage service that optimized for file storage. Some comes with free-trial-ish plan like aws-s3, Google's gcs, azure, and bunch others.
But if it really comes to a file storage in our own service, it's good enough to put all the files in the single same folder (flat file directory) and do the file categorization by attaching the file to the corresponding models.
Putting something like this in the data: { "username": "arege", "name": "Arle Greg", "profile_picture_file":"timestamp_somehash.png"}
For the second question, if your service need to record dates for all the uploaded file types in general, then its good to have that kind of model. But if its only for a little part of the file types in the service, it can just be written in the corresponding model along with the file link.
Upvotes: 1
Reputation: 181
{
id: 12345,
path: "s3://app_name/users/assets/images/5543_01_31_2019_10_05_33_avatar.jpg",
uploaded: "01-31-2019_10:05:33"
}
Upvotes: 2