1
我得到的plupload直接工作到亞馬遜S3 this示例代碼。我得到Direct Browser to S3 Upload使用臨時憑證。使用PlUpload和過期將文件上傳到亞馬遜Amazon S3鏈接
現在我需要生成到期亞馬遜S3鏈接和使用這些臨時證書需要實現Plupload。即我需要混合上面提到的兩種情況。所以我生成的URL並將其作爲URL在下面的代碼。
<script type="text/javascript">
$(function() {
$("#uploader").plupload({
runtimes : 'flash,silverlight',
url : 'TEMPORARY URL',
max_file_size : '10mb',
multipart: true,
multipart_params: {
'key': '${filename}',
'Filename': '${filename}',
'acl': 'public-read',
'Content-Type': 'image/jpeg',
'success_action_status': '201'
},
file_data_name: 'file',
multiple_queues: true,
filters : [
{title : "JPEG files", extensions : "jpg"}
],
flash_swf_url : '../../js/plupload.flash.swf',
silverlight_xap_url : '../../js/plupload.silverlight.xap'
});
});
</script>
到期了產生Amazon S3的鏈接
<?php
$S3_KEY='S3 Key Here';
$S3_SECRET='S3 Secret Here';
$S3_BUCKET='/uploadtestbucket';
$EXPIRE_TIME=(60 * 5); // 5 minutes
$S3_URL='http://s3.amazonaws.com';
$objectName='/' . $_GET['name'];
$mimeType=$_GET['type'];
$expires = time() + $EXPIRE_TIME;
$amzHeaders= "x-amz-acl:public-read";
$stringToSign = "PUT\n\n$mimeType\n$expires\n$amzHeaders\n$S3_BUCKET$objectName";
$sig = urlencode(base64_encode(hash_hmac('sha1', $stringToSign, $S3_SECRET, true)));
$url = urlencode("$S3_URL$S3_BUCKET$objectName? AWSAccessKeyId=$S3_KEY&Expires=$expires&Signature=$sig");
echo $url;
?>
但我收到此錯誤
IO錯誤。 錯誤#2032
我引用鏈接
- How do I make Plupload upload directly to Amazon S3?
- Upload directly to Amazon S3 using Plupload HTML5 runtime
什麼是我的代碼中的錯誤?