Create Asset S3 Usage

3 views
Skip to first unread message

Kevin

unread,
Nov 18, 2010, 8:40:18 PM11/18/10
to Sorenson Media Developer Group
I'm fairly new to not only using Sorenson API but also Amazon S3
usage.

I am able to access the Create Asset API without providing file
information and see that I get back S3 information. However I'm not
entirely sure how to use this information to upload the file. I've
signed up for a free dev S3 account but can't seem to figure it out as
I keep getting errors and have no clue if I'm doing it correctly or
not.

Does anyone have any guidance on how to do so?

By the way, I am using ColdFusion as the application server

David Dudas

unread,
Nov 18, 2010, 9:22:14 PM11/18/10
to sorenson-med...@googlegroups.com
Kevin,

After you get the S3 info back from Create Asset you need to use HTTP POST to upload your source file. Here's a sample CURL command:

curl -i -F AWSAccessKeyId=<aws_access_key_id> -F acl=public-read -F key=<s3_key> -F policy=<s3_policy> -F signature=<s3_signature> -F filename=<filename> -F file=@/local/path/to/file.mp4 http://<s3_bucket>.s3.amazonaws.com

And here's a sample POST with header info etc.:

POST /<s3_key> HTTP/1.1
Host: <s3_bucket>.s3.amazonaws.com
User-Agent: http-client-lib
x-amz-acl: public-read
Accept: video/*
Accept-Language: en-US
Accept-Encoding: compress, gzip
Accept-Charset: iso-8859-5
Keep-Alive: 300
Connection: keep-alive
Content-Type: multipart/form-data; boundary=9431149156168
Content-Length: <content_length>
--9431149156168
Content-Disposition: form-data; name="AWSAccessKeyId"
<aws_access_key_id>
--9431149156168
Content-Disposition: form-data; name="Policy"
<s3_policy>
--9431149156168
Content-Disposition: form-data; name="Signature"
<s3_signature>
--9431149156168
Content-Disposition: form-data; name="filename"
<filename>
--9431149156168
Content-Disposition: form-data; name="file"
<file_data>
--9431149156168
Content-Disposition: form-data; name="submit"
Upload to Amazon S3
--9431149156168--

-David
Reply all
Reply to author
Forward
0 new messages