1

I am building a web application with the React + ASP.NET Core template. The application will have a form for uploading recipes, including an image. I am hosting the application as an Azure Web App (App Service).

My question is: What is the best practice when it comes to storing the uploaded images? The first thing that comes to mind, is Azure Blob Storage, but I am unsure if this is actually the intended way? (I guess this is such a common feature, that there must be an intended way).

Bonus question: If it is actually Azure Blob Storage, is it just configured without any access restrictions, or should the files actually be protected and then delivered back via the API (which knows the credentials)?

7
  • how many images, how big and how do you want to access them?
    – Ewan
    Feb 11 at 19:11
  • @Ewan after upload, the recipes (and hence the images) should be publicly available. I haven't decided on a size limit yet, but I would imagine something like <3MB when uploaded and then scaled down to ~500kB after upload. In theory there is no limit on how many images could be uploaded, but it's one per recipe, so I'm guessing <1,000 for quite a while. Feb 11 at 19:26
  • 1
    just put a blob column on your database table
    – Ewan
    Feb 11 at 20:23
  • 1
    To summarize the existing comments and answers, using the database can be reasonable if you own the database server. In other words, if using it heavily doesn't add marginal cost. Otherwise, if the database is also a cloud service and metered by usage / workload, then use Azure Blob Storage.
    – rwong
    Feb 15 at 3:05
  • 1
    Regarding database check this out first stackoverflow.com/a/3751/13898633
    – inaba
    Feb 15 at 13:53

1 Answer 1

4

Definitly recommend Azure Blob Storage. It is the intended way. It’s also VERY cheap.

Blobs in SQL have no advantage except a dependency less.

But now you lose a lot of other free stuff like caching, and a very easily scaleable solution. You can also easily view or delete your data because you are working with normal files.

With SQL you also are unnecesarry constantly moving data through your web app, both hitting your database and web app.

Usually your SQL is going to be your scale and cost problem, so I don’t recommend adding more stuff to that.

7
  • One thing SQL also provides, is an easy local version, for debugging. How do you handle that, when using Azure Blob Storage? Feb 15 at 11:24
  • @JakobBuskSørensen There's a file manager for blobstorage with allows you to check and open what you upload incredibly easily. Or you can just store a link in your database and open that with your browser
    – inaba
    Feb 15 at 12:27
  • @inaba yea, I was just wondering if there was a solution where you didn't rely on an Azure resource for local debugging. But I may just be old fashioned :-) Feb 15 at 12:36
  • @JakobBuskSørensen why not though? Dunno what you mean by old fashioned. But it seems silly to want to store things on azure and not want to use their own tool to view them
    – inaba
    Feb 15 at 12:39
  • 1
    @JakobBuskSørensen I get your point. I use a Azure storage test account, just a mess with all kind of stuff but it works pretty fine in practice for my projects.
    – Dirk Boer
    Feb 15 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.