How to post FormData type object in ionic native HTTP


#1

Hi All

I’m trying to post a FormData type object, but it doesn’t seem to work for me. Below are some lines from my code, just see if you can suggest something in this approach:

let clientConfirmData = new FormData();
var blob = new Blob([this.signature], { type: ‘image/png’ });

clientConfirmData.append(“patientConfirmation”, blob);

this.http.post(url, clientConfirmData, headers)
.then(data =>{

                                    })
                                    .catch(error => {
                                      
                                    }));

so, my question is does clientConfirmData has to be a JSON object for it to work, won’t it work with FormData type object ? ( http is from ionic native’s not angular’s)

Thanks


#2

Have you set from data (application/x-www-form-urlencoded) in your header?