How to implement image upload via REST API in ionic3?

#1

hi to all,
I have to implement image upload functionality from gallery fn ionic3 and after image is selected properly and show selected image data but in the html section image is not display and also we have to pass this imagedata from the API but i got invalid param erro from the response of API.
I have used this plugin for image from gallary: https://ionicframework.com/docs/native/camera/
?
i have stuck this issue please check our code tell me what’s wrong in my code?
openGallery() {

let optionsGallery: CameraOptions = {
quality: 100,
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
}

this.camera.getPicture(optionsGallery).then((imageData) => {
this.base64Image = imageData;
//
var clientConfirmData = new FormData();
clientConfirmData.append(‘image’, this.base64Image);

var  value = clientConfirmData.get('image'); 

console.log(‘sss’ +value);

//postMethod for post data in the API…
this.service.imageUpload(this.service.baseurl()+ ‘update_profile_image’, clientConfirmData).then(data => {
console.log(‘dd’ +data);

},error => {
  console.log(error)
});

}, (err) => {
// Handle error
console.log(err)
})
}

imageUpload(url ,postData) {
let headers = new Headers();
headers.append(‘userid’, this.userId);

return this.http.post(url, postData, {headers:headers}).toPromise()
.then(res => {

  if(res.json().error==460 && res.json().status !=1){
     console.log('res 0000ffff ' +res);
  } else{
    return res.json();  
  }
}, err => {
    console.log('res 0000ffff ' +err);
});

}