在这个非常相关的问题(使用Plupload HTML5运行时直接上传到Amazon S3)中提到,亚马逊现在允许使用HTML5上传CORS,但有没有人成功配置plupload以使用'html5'运行时将文件推送到s3?对相关问题的回复不提供任何实施细节.
这是我当前的plupload配置:
$("#uploader").plupload({
// General settings
runtimes: 'html5,flash',
url: 'http://s3.amazonaws.com/' + $('#Bucket').val(),
max_file_size: '20mb',
multipart: true,
multipart_params: {
'key': '${filename}', // use filename as a key
'Filename': '${filename}', // adding this to keep consistency across the runtimes
'acl': $('#Acl').val(),
'Content-Type': 'binary/octet-stream',
'success_action_status': '201',
'AWSAccessKeyId': $('#AWSAccessKeyId').val(),
'policy': $('#Policy').val(),
'signature': $('#Signature').val()
},
file_data_name: 'file',
multiple_queues: true,
filters: [
{ title: "Image files", extensions: "jpg,png,gif,jpeg" }
],
flash_swf_url: '/Scripts/plupload/plupload.flash.swf',
});
Run Code Online (Sandbox Code Playgroud)
上面的代码适用于'flash'运行时,因此策略生成并正确签名.
我在multipart_params配置对象中缺少任何参数吗?
另外,我在s3存储桶上使用以下CORS配置:
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule> …Run Code Online (Sandbox Code Playgroud)