[英]How to create an object with Content-Type “application/directory” inside a rackspace CloudFiles Container with openstack.net?
I am trying to create a "directory" inside a Container, as long as I have read the rackspace api, to create it you should create a 0 or 1 byte object and assign the value "application/directory" to the Content-Type. 我正在尝试在Container中创建一个“目录”,只要我读取了rackspace api,创建它就应该创建一个0或1字节的对象,并将值“application / directory”赋给Content-Type。
I tried this: 我试过这个:
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);
But I get an exception 但我得到一个例外
The 'Content-Type' header must be modified using the appropriate property or method. 必须使用适当的属性或方法修改“Content-Type”标头。 Parameter name: name
参数名称:名称
Do anyone have created these kind of object? 有没有人创造过这种物体?
I think you are adding the wrong header. 我认为你添加了错误的标题。 Instead of "name", try setting the value to "ContentType":
尝试将值设置为“ContentType”而不是“name”:
dicHeaders.Add("ContentType", "application/directory");
Update: I think that in general directories are not needed. 更新:我认为通常不需要目录。 Let's say you create an object, called "User/Foo/Bar.jpg".
假设您创建了一个名为“User / Foo / Bar.jpg”的对象。 If you look in your container through the website, you will the image with this name.
如果您通过网站查看容器,则会显示具有此名称的图像。 However, if you open your container with CyberDuck, you will find a folder User, inside it another one called Foo, and inside it will be the file Bar.jpg.
但是,如果你用CyberDuck打开你的容器,你会发现一个名为User的文件夹,另一个叫做Foo的文件夹,里面是文件Bar.jpg。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.