I just started the Quickstart with .NET v12 SDK https://learn.microsoft.com/da-dk/azure/storage/blobs/storage-quickstart-blobs-dotnet
But i cant seem to find out how to specify a ContentType when uploading a blob.
Does anyone know that?
Thanks in advance.
You can set it as follows,
await blobClient.UploadAsync(stream, true, default);
await blobClient.SetHttpHeadersAsync(new BlobHttpHeaders
{
ContentType = contentType
});
EDIT: As mentioned in the comment, the efficient way to do the same with a single method as follows,
await blobClient.UploadAsync(ms, new BlobHttpHeaders{ ContentType = "text/plain"});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With