3

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 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.

4

1 回答 1

5

根据StoreSetMetadata的在线文档,第二个参数是结构类型,而不是数组类型。

尝试

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

<cfset StoreSetMetadata("s3://mybucket/#bgfull#", meta)>
于 2012-09-24T14:41:08.167 回答