title: Angular 7 upload image to s3 which is in base64 form
body: <p>In Ionic 4 angular 7 application trying to upload an image from the Cordova camera plugin.</p>
  
  <p>The output from the Camera plugin is base64 image data.</p>
  
  <pre><code>this.camera.getPicture(options).then((imageData) =&gt; {
    // imageData is either a base64 encoded string or a file URI
    // If it's base64 (DATA_URL):
    const base64Image = 'data:image/jpeg;base64,' + imageData;
  
    this.uploadImage(url, base64Image )
  }, (err) =&gt; {
    // Handle error
  }); 
  </code></pre>
  
  <p>I am generating an AWS S3 pre-signed URL to upload an Image on server side.  </p>
  
  <p>e.g <a href="http://127.0.0.1/gdcom/63a5d901-7966-11ea-bf01-a7a6315cc36d/d418baf3-8129-11ea-a67d-3646e8bf199f.jpeg?AWSAccessKeyId=remote-identity&amp;Expires=1587183624&amp;Signature=mC6CRT6sPVKeCKM0aVj%2ByKzDy%2F8%3D" rel="nofollow noreferrer">http://127.0.0.1/gdcom/63a5d901-7966-11ea-bf01-a7a6315cc36d/d418baf3-8129-11ea-a67d-3646e8bf199f.jpeg?AWSAccessKeyId=remote-identity&amp;Expires=1587183624&amp;Signature=mC6CRT6sPVKeCKM0aVj%2ByKzDy%2F8%3D</a></p>
  
  <p>Below code does not give any error, but the uploaded image is just a black screen and not the actual image.  </p>
  
  <p>What is the correct way to HTTP PUT an Image to S3, the available image in base64 encoded format?</p>
  
  <pre><code>uploadImage(url: string, imageData: any): Promise&lt;any&gt; {
      const headers = new HttpHeaders({'Content-Type': 'image/jpeg;'});
  
      return this.http.put(url, imageData, {headers: headers})
          .pipe(
              tap(data =&gt; console.log(JSON.stringify(data))),
              catchError(this.handleError('uploadImage'))
          ).toPromise();
  }
  </code></pre>