Skip to content

How to upload to S3 after getting the signed Url from the backend? #327

Open
@harishankards

Description

@harishankards

Hi,
In my project, I'm using nodejs for backend API and vue for the frontend. I'm using this vue-dropzone in my project.

So, when a file is successfully uploaded into the frontend, I'm taking the filename and type to the backend to create a signedUrl to upload the files in AWS S3. Please refer to the code below.

dropzoneOptions: {
          url: 'http://localhost:3000/attachments', //I'm sending the req to my backend to get the signedUrl
          thumbnailWidth: 150,
          maxFilesize: 0.5,
          headers: { 'Authorization': 'Bearer ' + this.token },
          addRemoveLinks: true,
          dictDefaultMessage: "<i class='fa fa-cloud-upload'></i>UPLOAD ME"
        }

and the success function

vsuccess (file, response) {
        console.log('it is success', file, response) // this response has the signedUrl from my backend       
      }

Now, that I have the signedUrl here, how do I send the file to the S3?

In the example provided by you here, the signedURL seemed to be put in a hardcoded way.
But, I'm doing in a dynamic way. So, how do I achieve that?

Thanks in advance.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions