i use ionic camera plugin as well same as this link: https://ionicframework.com/docs/v3/native/camera/
my server is wordpress and my ionic app can upload my images files as well. i can browse from gallery or take new image.
after take new image from camera, user can click on upload button then base64 file appears as well. then he can uploaded but wordpress cant detect it as jpeg or png.
and when i download it cant open with paint or like that
this is my code:
let token = JSON.parse(localStorage.getItem('wpIonicTokenRaahee')).token;
console.log(token);
console.log(this.api_url_post_media);
let headers = new HttpHeaders({
'cache-control': 'no-cache',
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': `Bearer ${token}`,
'content-disposition': 'attachment; filename=' + filename + '.jpeg',
});
return this.http.post(this.api_url_post_media, data, { headers: headers });
i tested any content-type like image/png image/jpeg or etc
please help me.. i can upload image via postman... but i dont know how can i convert and upload my base64 file as binary file to my server