AWS.config.update({
region: bucketRegion,
credentials: new AWS.CognitoIdentityCredentials({
IdentityPoolId: IdentityPoolId
})
});
function upload_image(id){
var files = document.getElementById(id).files;
if (!files.length) {
return alert("Please choose a file to upload first.");
}
var file = files[0];
var fileName = file.name;
var albumPhotosKey = encodeURIComponent(albumBucketName) + "//";
var photoKey = albumPhotosKey + fileName;
// Use S3 ManagedUpload class as it supports multipart uploads
var upload = new AWS.S3.ManagedUpload({
params: {
Bucket: albumBucketName,
Key: photoKey,
Body: file,
ACL: "public-read"
}
});
var promise = upload.promise();
promise.then(
function(data) {
alert("Successfully uploaded photo.");
viewAlbum(albumName);
},
function(err) {
console.log(err)
return alert("There was an error uploading your photo: ", err.message);
}
);}
при загрузке изображения в корзину S3 через JS сообщение показывает ошибку отказа в доступе. при ошибке консоли браузера ([HTTP / 1.1 403 Forbidden 2156ms]). все настройки ведра: publi c. **