How upload blob in Azure Blob Storage with specified ContentType with .NET v12 SDK?

后端 未结 2 421
忘掉有多难
忘掉有多难 2020-12-02 00:58

I just started the Quickstart with .NET v12 SDK https://docs.microsoft.com/da-dk/azure/storage/blobs/storage-quickstart-blobs-dotnet

But i cant seem to find out how

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 01:40

    Please try this override of UploadAsync method. This method will upload and set the content type in a single network call.

    Here would be your code:

    var httpHeaders = new BlobHttpHeaders
     {
        ContentType = contentType
     });
    await blobClient.UploadAsync(stream, httpHeaders);
    

提交回复
热议问题