Azure / Azure/azure-storage-cpplite

How to Set Blob Content-Type

Open
#107 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
26
Forks
50
PR merge metrics
No merged PRs in 30d

Description

When uploading to azure blob an image via stream, it always sets the content type to "application/octet-stream". How do you change the content type when it is uploaded?

I've tried setting the meta content as follows:

```
vector> metadata(1, std::make_pair("Content-Type", "image/jpg"));
client.upload_block_blob_from_stream(AZURE_BLOB_CONTAINER, filename, istream, metadata);

```
This only adds meta content, but doesn't change the blob properties. I've also tried to directly change the curl request headers:

```
auto bc = std::make_shared(account, 16);
std::shared_ptr http_request = bc->client()->get_handle();
http_request->add_header("Content-Type", "image/jpg");
vector> metadata;
bc->upload_block_blob_from_stream(AZURE_BLOB_CONTAINER, filename, istream, metadata);

```
Any help would be greatly appreciated.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.