0

I’ve tried using signed URL from s3 and send base64encoded image But in my s3 bucket, I am only seeing a file called mykey. SignedUrl came back successful. Any suggestion on what I am doing wrong?

  const file = this.fileInput.nativeElement.files[0];
  if (file) {

  const reader = new FileReader();
  reader.readAsDataURL(this.fileInput.nativeElement.files[0]);
  reader.onload = () => {
    this.fileDataUri = reader.result;
  }
} 

// get only the base64 file
if (this.fileDataUri.length > 0) {
      const base64File = this.fileDataUri.split(',')[1];
      this.store.dispatch(new fromPropertyAction.GetUserSession(base64File));
      console.log(base64File);
   }

}

In my action, I dispatch this API call:

const data = {'image': base64File};
this.httpClient.put(signedUrl, data)
John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Evan
  • 507
  • 2
  • 7
  • 21
  • 1
    You ask what you are doing wrong, but you have not actually mentioned what is *going wrong*. How is this failing? What is the error? Or if no error, what is the issue? – Michael - sqlbot Mar 18 '18 at 19:24
  • I am trying to upload an image in base64 encoding. But all I see after the above code is a file called mykey in s3 after execution. So I was expecting that image file to be uploaded in s3 and not mykey file. Hope this helps to clarify. Thank you! – Evan Mar 19 '18 at 00:58

0 Answers0