How to send form data with ionic native http!

async uploadImageData(formData: FormData) {

const loading = await this.loadingController.create({

  message: 'Uploading image...',

});

await loading.present();

let nativeCall = this.nativehttp.put(url, formData, {});



from(nativeCall).pipe(

  finalize(() => {

    loading.dismiss();

  })

).subscribe(res => {

  if (res['success']) {

    this.presentToast('File upload complete.');

  } else {

    this.presentToast('File upload failed.');

  }

});

}

}
i have a problem with my async uploadImageData method. can anyone help me out?
for http im using ionic native http.
can not send form data.

1 Like

Check some of this tutes they’ll point you in the direction you need to go

https://www.positronx.io/how-to-use-angular-8-httpclient-to-post-formdata/

https://www.techiediaries.com/angular-formdata/

this is angular http not ionic native http

Hi dimithrab, I am facing similar issue, have u found a solution?

I would recommend using Angular HttpClient. If the reason you aren’t doing that is because you don’t have an SSL cert for your backend, get one. If the next acronym out of your mouth is going to be “CORS”, fix that on the server too.