title: Not able to send image via POST api
body: <p>I have a requirement where I need to select an image from phone library/camera and upload to server via POST api. I am able to load the image from the library but getting an error while sending the image using the post request</p>
  <p>My HTML Code:</p>
  <pre><code>&lt;p (click)=&quot;selectImage()&quot;&gt;Add an attachment&lt;/p&gt;&lt;/ion-item&gt;
  </code></pre>
  <p>my .ts file:</p>
  <pre><code>import { HTTP } from &quot;@ionic-native/http/ngx&quot;;
  
    async selectImage() {
      const actionSheet = await this.actionSheetController.create({
        header: 'select image',
        buttons: [{
          text: 'Load from library',
          handler: () =&gt; {
            this.takePicture(this.camera.PictureSourceType.PHOTOLIBRARY);
          }
        },
        {
          text: 'Cancel',
          role: 'cancel'
        }
        ]
      });
      await actionSheet.present();
    }
  
  
    takePicture(sourceType: PictureSourceType) {
      var options: CameraOptions = {
        quality: 100,
        sourceType: sourceType,
        saveToPhotoAlbum: false,
        correctOrientation: true
      };
      this.camera.getPicture(options).then(imagePath =&gt; {
        if (this.platform.is('android') &amp;&amp; sourceType === this.camera.PictureSourceType.PHOTOLIBRARY) { 
          this.file.resolveLocalFilesystemUrl(imagePath).then((entry: FileEntry) =&gt; {
            entry.file(file =&gt; {
              console.log(file);
              this.readFile(file);
            });
          });
        }
      });
    }
  
  
     readFile(file: any) {
      const reader = new FileReader();
      reader.onloadend = () =&gt; {
        const formData = new FormData();
        const imgBlob = new Blob([reader.result], {
          type: file.type
        });
        formData.append('file', imgBlob, file.name);     
        this.uploadImageData(formData)
      };
      reader.readAsDataURL(file);
    }
  
  
   async uploadImageData(formData) {
      let feedbackData = {
        attachment: formData,
        feedback: 'test text'
      }
      this.http.post('http://abctest.rapidesk.in/api/feedback/', feedbackData, { 'Content-Type': 'application/json', 'Authorization': &quot;Token&quot; + &quot; &quot; + this.authToken })
        .then(data =&gt; {
          console.log(data);
        }).catch(err =&gt; {
          console.log(err)
        })
    }
  </code></pre>
  <p>This is the error I am getting in the console while sending the image data via the api.
  <a href="https://i.stack.imgur.com/0ogsZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0ogsZ.png" alt="enter image description here" /></a></p>