使用AWS javascript SDK进行分段上传,在IE上给出“上传ID丢失”错误

时间:2019-05-17 11:01:57

标签: amazon-web-services amazon-s3 browser upload

使用javascript sdk进行分段上传,在Internet Explorer上给出了上载ID缺失错误,该浏览器可在Firefox和Chrome等其他浏览器上使用。

这适用于Chrome和Firefox。

<script src="https://sdk.amazonaws.com/js/aws-sdk-2.179.0.min.js"></script>
var key = 'XXXXXXXXXXXXXXXXXXX';
var SecretKey = 'https://forums.aws.amazon.com/';
//document.getElementById('AWSAccessKeyId').value;
var BucketName = 'bucket name';
var acl = document.getElementById('acl').value;
var content_type = file.type;
AWS.config.update({
accessKeyId: key,
secretAccessKey: SecretKey
});
AWS.config.region = 'us-east-2';

var bucket = new AWS.S3({params: {Bucket: BucketName, apiVersion: '2006-03-01',region: 'us-east-2'}});
var params = {Key: 'caseattachfolder/'+file.name, ContentType: content_type, Body: file, ACL: acl};

bucket.upload(params,function(err, data){
console.log(data);
} );

0 个答案:

没有答案