Storing and displaying images
Hello! I have a blazor web app with an Asp.Net Core API and a SQL Server Db. I want to store images in my database as varbinary(max) datatype and i want to insert them and read them whenever I want in my website. But I can't find any meaningful resources that explain how to do that. Can anyone help or give some advice? Thx
6 Replies
Bad idea
Store the images on a CDN or in the filesystem and only keep their path or URL in the database
how does the filesystem work
Just make a file on the disk
Agreed, storing images in data storage can become extremely large, with a pita management scenario.
Take look at how nopcommerce does their Media services. Maybe you can get some reference from it, and adopt your own from it.
https://github.com/nopSolutions/nopCommerce/blob/develop/src%2FLibraries%2FNop.Services%2FMedia%2FPictureService.cs
GitHub
nopCommerce/src/Libraries/Nop.Services/Media/PictureService.cs at d...
ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart. - nopSolutions/nopCommerce
thx