![](/img/trans.png)
[英]How to get jpg file from CloudFiles on Rackspace using openstack.net
[英]How to create an object with Content-Type “application/directory” inside a rackspace CloudFiles Container with openstack.net?
我正在嘗試在Container中創建一個“目錄”,只要我讀取了rackspace api,創建它就應該創建一個0或1字節的對象,並將值“application / directory”賦給Content-Type。
我試過這個:
var cloudFilesProvider = new CloudFilesProvider(_cloudIdentity);
Dictionary<string, string> dicHeaders = new Dictionary<string, string>();
dicHeaders.Add("name", "application/directory");
MemoryStream ms = new MemoryStream(1);
cloudFilesProvider.CreateObject(ContainerName, ms, DirectoryPath, 0, dicHeaders);
但我得到一個例外
必須使用適當的屬性或方法修改“Content-Type”標頭。 參數名稱:名稱
有沒有人創造過這種物體?
我認為你添加了錯誤的標題。 嘗試將值設置為“ContentType”而不是“name”:
dicHeaders.Add("ContentType", "application/directory");
更新:我認為通常不需要目錄。 假設您創建了一個名為“User / Foo / Bar.jpg”的對象。 如果您通過網站查看容器,則會顯示具有此名稱的圖像。 但是,如果你用CyberDuck打開你的容器,你會發現一個名為User的文件夾,另一個叫做Foo的文件夾,里面是文件Bar.jpg。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.