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',
        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);

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.


I believe that you have to try to add your domain name the CORS Configurations under your DigitalOcean Control panel:

  • Go to your DigitalOcean Control Panel
  • Then go to Space
  • Select your Space
  • Click on Settings
  • Under the CORS Configurations add your domain name and select GET.

Hope that this helps! Regards, Bobby