Hey all,
I'm trying to upload the file icon from a blob that is already uploaded. I'm using sasuri for the existing blob, (the one i want to upload the fileicon for).
Something like this:
var SASURI = GetUploadedFileIconSASURL(blobnamehere);
var fileIcon = System.Drawing.Icon.ExtractAssociatedIcon(SASURI);
CloudBlobContainer blobContainer = CloudStorageServices.GetCloudBlobContainer();
CloudBlockBlob blockBlob = blobContainer.GetBlockBlobReference(blobiconnamehere);
using (var stream = fileIcon.Openread())
{
blockBlob.UploadFromStream(stream);
}
How can I upload a blockblob from a variabel like that? The stream is incorrect, does not contain a definition for OpenRead. (Im a newbie bare with me!)
Also, in theory, would this work? Will the icon be saved as a image?
Thanks in advance!!
Update 1:
var SASURI = GetUploadedFileIconSASURL(existingBlobNameHere);
var fileIcon = System.Drawing.Icon.ExtractAssociatedIcon(@"C:\WINDOWS\system32\notepad.exe");
CloudBlobContainer blobContainer = CloudStorageServices.GetCloudBlobContainer();
CloudBlockBlob blockBlob = blobContainer.GetBlockBlobReference(blobiconnamehere);
Bitmap bmpIcon = fileIcon.ToBitmap();
using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{
bmpIcon.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
blockBlob.UploadFromStream(ms);
}
Its running but the file icon blob is null(?)