0

I'm working on a new project. It is a smartphone application made with react-native. In the app, you can create "cards" which are having a title, a description and a photo, taken by the user's phone.

I will use a SQL Server database, hosted on Azure and I'm currently working on the REST-API whit ASP.NET core with the Entityframwork Core. This is basically not a new workflow for me, but I have never done this with file upload and storage.

Now my question is, how can and should I deal with file upload. The most obvious to me is to store the file on some kind of cloud storage server and save the URL to the image in the database so that I can simply have an Image-Tag in my mobile application with the URL as source-property.

Another way, I found is to store the image as a byte array directly to the database. But I don't like this way of doing it, because then I have to transfer the whole image whenever I want to display it.

Is there a common way to achieve this? I really want to use just Azure because I've just started using the free 12-month trial.

Thanks, Roman

1 Answer 1

0

You can use Azure Blob storage to upload your images or any other files. You can choose upload the image in the Blob storage and either:

  1. Get the URI of the stored file, and save the URL of the image in the database.
  2. Store the unique reference (which is the file name that you provide when you upload) in the database, download the image from your server and then transfer it on to your front end. (Avoid this option if you want to avoid the overhead of transferring the image from your backend server to your client-side)

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.