Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Set Blob Content-Type #107

Open
dczaretsky opened this issue Oct 21, 2020 · 1 comment
Open

How to Set Blob Content-Type #107

dczaretsky opened this issue Oct 21, 2020 · 1 comment

Comments

@dczaretsky
Copy link

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<pair<string,string>> 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<blob_client>(account, 16);
std::shared_ptr<azure::storage_lite::http_base> http_request = bc->client()->get_handle();
http_request->add_header("Content-Type", "image/jpg");
vector<pair<string,string>> metadata;
bc->upload_block_blob_from_stream(AZURE_BLOB_CONTAINER, filename, istream, metadata);

Any help would be greatly appreciated.

@Jinming-Hu
Copy link
Member

@dczaretsky cpplite doesn't support this feature. I recommend you use our Track2 cpp sdk. https://github.com/Azure/azure-sdk-for-cpp/tree/master/sdk/storage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants