这是我的Uploadify的以下代码,用于将文件直接上传到Amazon S3:
<html>
<head>
<link rel="stylesheet" href="uploadify.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.uploadify-3.1.min.js"></script>
<script type="text/javascript">
$(function() {
$('#file_upload').uploadify({
'requeueErrors' : true,
'fileDataName' : 'file',
'method' : 'post',
'formData' : {
'key': 'uploads/${filename}',
'AWSAccessKeyId': 'xxxxxxxxxxxxxxxxxxx',
'bucket': 'mybucket',
'acl': 'authenticated-read',
'policy': 'xxxxxxxxxxxxxxxxx',
'signature': 'xxxxxxxxxxxxx',
'Content-Type': 'text'
},
'fileObjName' : 'file',
'cancelImg' : 'cancel.png',
'uploader' : 'http://mybucket.s3.amazonaws.com',
'swf' : 'uploadify.swf',
'auto' : false,
'fileType' : 'text',
'onUploadStart': function(file)
{
console.log('Attempting to upload: ' + file.name);
},
'onUploadSuccess': function(file, data, response)
{
alert('The file was saved to: ' + data);
}
});
});
</script>
</head>
<body>
<form>
<p><input type="file" name="file_upload" id="file_upload" /></p>
<p><a href="javascript:$('#file_upload').uploadify('upload')">Upload Files</a></p>
</form>
</body>
</html>
当我尝试将文件上传到Amazon S3时,出现以下错误:HTTP 错误 (403) 请帮助解决代码中的问题。