Can anyone tell me how to use Uploadify to upload directly to Amazon S3?
My code is as follows:
$('#fileInput').uploadify({
'fileDataName' : 'file',
'uploader' : 'uploadify.swf',
'script' : 'http://BUCKET-NAME-GOES-HERE.s3.amazonaws.com/',
'cancelImg' : 'cancel.png',
'method' : 'post',
'auto' : true,
'onError': function (a, b, c, d) {
alert('error '+d.type+": "+d.info + ' name: ' + c.name + ' size: ' + c.size);
},
'scriptData' : {
'AWSAccessKeyId': "KEY-GOES-HERE",
'key': "${filename}",
'acl': "public-read",
'policy': "POLICY-STRING-GOES-HERE",
'signature': "SIGNATURE-GOES-HERE",
'success_action_status': '200'
}
});
My (unencoded) policy string looks like this:
{ "expiration": "2100-12-01T12:00:00.000Z",
"conditions": [
{"acl": "public-read" },
{"bucket": "BUCKET-NAME-GOES-HERE" },
{"success_action_status" : 200},
["starts-with", "$filename", "" ],
["starts-with", "$folder", "" ],
["starts-with", "$key", ""],
["content-length-range", 1, 209715200]
]
}
Using the above code actually allows me to select a file, which it then appears to upload (somewhere), but nothing shows up in my S3 bucket and no errors are returned to the JS console.
Using a regular HTML form to post a file to the S3 bucket works fine.
Any advice?