首页 文章

是否可以对现有Azure blob进行内容处理?

提问于
浏览
1

根据刺激回答这里:Azure Storage API ContentDisposition

和在这里找到的信息:Friendly filename when public download Azure blob

我可以在上传新文件时设置内容处理 . 但我也希望能够设置现有文件的内容配置 .

blob.Properties.ContentDisposition = string.Format("attachment;filename=\"{0}\"", friendlyName);

在上传文件之前设置时工作正常,但如果我在现有blob上尝试它则无效 .

改变现有blob的内容配置或者我做错了是不可能的?

1 回答

  • 2

    是 . 设置 ContentDisposition 后,您只需在blob上调用 SetProperties() 方法 . 所以你的代码应该是:

    blob.FetchAttributes();//Fetch properties first so that you don't overwrite existing properties when you call SetProperties
                blob.Properties.ContentDisposition = string.Format("attachment;filename=\"{0}\"", friendlyName);
                blob.SetProperties();
    

相关问题