uploadphoto() {
console.log(‘default’,“Its printed here the filename”)
let filename = this.imagePath.split(’/’).pop(); // this.image have data
let options = {
fileKey: “file”,
fileName: filename,
chunkedMode: false,
params:{‘id’: this.userId},
mimeType: “multipart/form-data”,
// headers:{‘formData’:formData}
};
const fileTransfer:FileTransferObject=this.transfer.create();
fileTransfer.upload(this.imagePath,‘API’,
options).then((entry) => {
// this.imagePath = ‘’;
this.imageChosen = 0;
console.log(entry+“file Entry”);
// loader.dismiss();
}, (err) => {
console.log("this is the error of file upload"+JSON.stringify(err));
});
}
this.camera.getPicture(options).then((imgUrl) => {
console.log("Firstly=====>"+imgUrl);
this.imagePath = imgUrl;
console.log("BinaryImage: ", this.imagePath);
}, (err) => {
console.log("this is the error which caused it:"+err);
});
}