冷融Amazon S3-设置内容类型? [英] Coldfusion & Amazon S3 - Setting the Content Type?
问题描述
我已经将Amazon S3用于内容已有一段时间了,但是我遇到了一个需要设置上传图像的内容类型的实例(需要在上传时执行此操作).我已经尝试了一些方法,但是似乎无法确定StoreSetMetaData的正确语法.
I've used Amazon S3 for content for a while now, but I've just run across an instance where I need to set the content type for uploaded images (need to do this at the point of upload). I've tried a few things, but can't seem to nail the correct syntax for StoreSetMetaData.
这就是我现在正在做的事情...
This is how I'm doing it right now...
<cfset meta = [{content_type="Image"}]>
<cfset StoreSetMetadata("s3://mybucket/#bgfull#", "#meta#")>
其余的代码不是必需的,因此我只粘贴了相关的两行.
The rest of the code isnt necessary, so I've just pasted in the relevant 2 lines.
使用这种语法,出现以下错误;
Using this syntax, I get the following error;
"500您试图将类型为coldfusion.runtime.Array的标量变量取消引用为具有成员的结构."
"500 You have attempted to dereference a scalar variable of type class coldfusion.runtime.Array as a structure with members."
非常感谢指针!我无法为此找到一个语法示例.
Pointers much appreciated! I haven't been able to track down a single syntax example for this.
推荐答案
According to the online documentation of StoreSetMetadata the second argument is of type struct, and not of type array.
尝试
<cfset meta = {content_type="Image"}>
<cfset StoreSetMetadata("s3://mybucket/#bgfull#", meta)>
这篇关于冷融Amazon S3-设置内容类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!