I’ve built a simple website with authorization and registration system.
So I have user accounts and I wonder where to store profile pictures for every user.
I tried to store them in MYSQL in BLOB, but I don’t think it is the best way to do this.
I’ve built a simple website with authorization and registration system.
So I have user accounts and I wonder where to store profile pictures for every user.
I tried to store them in MYSQL in BLOB, but I don’t think it is the best way to do this.
2
Answers
The short answer is in most cases a file system (eg. the server where your code is hosted, if that’s an option).
Read this short article:
If you do not have access to storing images on your server or enough space, you could take a look into hosting you images on an image server.
Most people have the opinion that files should reside on the filesystem, outside the database. But there are exceptions to every rule. There are some good reasons to keep large binaries inside the database, depending on your project requirements.
See some of my past answers on this topic:
I also cover this in the chapter "Phantom Files" in my book, SQL Antipatterns Volume 1: Avoiding the Pitfalls of Database Programming.