Lee
Lee

Reputation: 999

Coldfusion & Amazon S3 - Setting the Content Type?

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.

Upvotes: 3

Views: 539

Answers (1)

jan
jan

Reputation: 2958

According to the online documentation of StoreSetMetadata the second argument is of type struct, and not of type array.

Try

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

<cfset StoreSetMetadata("s3://mybucket/#bgfull#", meta)>

Upvotes: 5

Related Questions