Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

private async Task<string> UploadBlobStorage(IFormFile filepayupload)
{
string url = string.Empty;
if (filepayupload != null)
{
using (var stream = new MemoryStream())
{
await filepayupload.CopyToAsync(stream);
var streamArray = stream.ToArray();
public async Task<byte[]> GetImageAsByteArray(string imageFilePath)
{
CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse(connectionStorage);
CloudBlobClient cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
CloudBlobContainer cloudBlobContainer = cloudBlobClient.GetContainerReference (containerReferrence);
CloudBlob cloudBlob = cloudBlobContainer.GetBlobReference(new CloudBlockBlob(new Uri(imageFilePath)).Name);
await cloudBlob.FetchAttributesAsync();
long fileByteLength = cloudBlob.Properties.Length;
Byte[] myByteArray = new Byte[fileByteLength];
Install-Package WindowsAzure.Storage -Version 9.2.0