Question
Unable to upload images into spaces in angular
When i try to upload images into spaces i am getting 403 forbidden issue and cors issue.
s3 = new AWS.S3({
endpoint: endPoint,
accessKeyId: accessKey,
secretAccessKey: secretKey
});
const params = {
Bucket: 'test-upload',
Key: file.name,
Body: file,
ContentType: file[0].type,
ACL: 'public-read',
// CORSConfiguration: { CORSRules: this.corsRules }
// headers: { 'Access-Control-Allow-Origin': '*' }
};
this.s3.putObject(params, (err, data) => {
if (err) {
console.log('err', err);
} else {
console.log('Successfully uploaded data to DO speaces', data);
}
});
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×