简体   繁体   English

RackSpace OpenCloud PHP SDK和mime类型?

[英]RackSpace OpenCloud PHP SDK and mime types?

I've been using the latest PHP SDK and have managed to create a simple script ( https://gist.github.com/nickweavers/9936267 ) to create a container, upload objects into it, list and view them. 我一直在使用最新的PHP SDK,并设法创建了一个简单的脚本( https://gist.github.com/nickweavers/9936267 )以创建一个容器,将对象上传到其中,列出并查看它们。 But Can someone tell me if the SDK is able to figure out the mime types of files that are uploaded and make that info available to us or do we need to store it in the file objects meta data? 但是,有人可以告诉我SDK是否能够弄清上传的文件的mime类型并使该信息对我们可用,还是我们需要将其存储在文件对象元数据中? At the moment my test script has a header("Content-Type: application/pdf"); 目前,我的测试脚本具有标题(“ Content-Type:application / pdf”); hard coded, and I would like to handle this automatically. 硬编码,我想自动处理。

TIA, Nick TIA,尼克

CloudFiles should be detecting the content type for you (by extension), as long as you don't explicitly state the type. 只要您没有明确声明类型,CloudFiles 就会为您检测内容类型(按扩展名)。

To make sure it detects the right content type on subsequent POSTs or PUTs, set X-Detect-Content-Type: True . 要确保它在后续的POST或PUT中检测到正确的内容类型,请设置X-Detect-Content-Type: True

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM