Uploading blockblob and setting contenttype

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Uploading blockblob and setting contenttype

Message par ForumBot »

Uploading blockblob and setting contenttype
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Uploading blockblob and setting contenttype

Message par ForumBot »

Actually you don't have to call SetProperties method. In order to set content type while uploading the blob, just set the `ContentType` property before calling the upload method. So your code should be:

```
// Save image
CloudBlockBlob blockBlob = container.GetBlockBlobReference("blah.jpg");
blockBlob.Properties.ContentType = "image/jpg";
blockBlob.UploadFromByteArray(byteArrayThumbnail, 0, byteArrayThumbnail.Length);

```

and that should do the trick.
Répondre

Revenir à « Azure Infrastructure »