Hi,
I am trying to upload a signature (which is in Canvas.toDataURL() format) to Azure Blob Storage. The problem I am facing is that the image I am getting is not in the form that azure accepts.
Can anyone help me with how I can convert it to the required form?
JavaScript
var image = element.toDataURL("image/png").replace("image/png", "image/octet-stream");
localStorage.setItem('SignatureValue',image);
window.location.href=image;
return image;

Sachin SinghRank #66 · 26.2K reputationPosted Jan 6, 2023, 1:41 AM EST
sir, In asp.net mvc i have done it like this
var img = canvas.toDataURL('image/jpeg', 0.9).split(',')[1]; // ajax post data:imgin controller
byte[] bytes = Convert.FromBase64String(image); CloudStorageAccount storageAccount = CloudStorageAccount.Parse(AzureString); CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); CloudBlobContainer container = blobClient.GetContainerReference("img"); string ImageFileName = RandomString(5) + ".jpg"; CloudBlockBlob imgBlockBlob = container.GetBlockBlobReference(ImageFileName); using (MemoryStream ms = new MemoryStream(bytes)) { imgBlockBlob.UploadFromStream(ms); }Rohit GuptaRank #11 · 59.9K reputationPosted Jan 8, 2023, 1:03 AM EST
Thanks Sachin