Coldfusion和Amazon S3-设置内容类型?

Lee*_*Lee 3 coldfusion amazon-s3

我已经将Amazon S3用于内容已有一段时间了,但是我遇到了一个需要设置上传图像的内容类型的实例(需要在上传时执行此操作)。我已经尝试了一些方法,但是似乎无法确定StoreSetMetaData的正确语法。

这就是我现在正在做的事情...

<cfset meta = [{content_type="Image"}]>

<cfset StoreSetMetadata("s3://mybucket/#bgfull#", "#meta#")>
Run Code Online (Sandbox Code Playgroud)

其余代码不是必需的,因此我只粘贴了相关的两行。

使用这种语法,我得到以下错误;

“ 500您试图取消引用类型为coldfusion.runtime.Array的标量变量作为具有成员的结构。”

指针非常感谢!我还无法为此找到一个语法示例。

jan*_*jan 5

根据StoreSetMetadata的在线文档 the second argument is of type struct, and not of type array.

尝试

<cfset meta = {content_type="Image"}>

<cfset StoreSetMetadata("s3://mybucket/#bgfull#", meta)>
Run Code Online (Sandbox Code Playgroud)