[Vuejs]-Uploading images to a server with blob

1👍

Ideally we should try to send the image as POST to the API in ASP.NET and then call the API for uploading the image.
Instead of taking the image directly and uploading, we must check if the file is not corrupted (or any other issue) and then upload it.

In .NET, try out the below code:

string loc = Directory.GetCurrentDirectory() + "/" + location;
CloudStorageAccount account = CloudStorageAccount.Parse(*connection_string*);
CloudBlobClient client = account.CreateCloudBlobClient();
CloudBlobContainer container = client.GetContainerReference(*container_name*);

container.CreateIfNotExists();
CloudBlockBlob blob = container.GetBlockBlobReference(*blobName*);
blob.UploadFromFile(loc);

Leave a comment