Hello,
I have a page that contains both text and picture
And when i want to POST all the data, it send only NULL Values.
MY POST CODE :
declarerSinistre(){
//http://michael.laffargue.fr/blog/2016/04/17/angularjs2-send-http-post-request-with-parameters-to-php/
var headers = new Headers();
headers.append('Content-Type','multipart/form-data');
var params = '&entry_by='+this.userDetails.id+'&NomConducteur='+this.userData.NomConducteur+'&TelConducteur='+this.userData.TelConducteur+'&CinConducteur='+this.userData.CinConducteur+'&latitude='+this.la+'&longitude='+this.lo+'&justif1='+this.imageUpload;
this.http.post(this.apiSinistre, params , {headers: headers})
.subscribe(
data => this.afficherAlert('Réussite','Sinistre Déclaré'),
err => this.afficherAlert('Erreur','Sinistre Non Déclaré')
);
}
AND THE PICTURE PART
/*PARTIE PHOTO DEBUT*/
ngOnInit() {
this.photos = [];
}
deletePhoto(index) {
let confirm = this.alertCtrl.create({
title: "Est-ce que vous êtes sûr ?",
message: "",
buttons: [
{
text: "Non",
handler: () => {
console.log("Disagree clicked");
}
},
{
text: "Oui",
handler: () => {
console.log("Agree clicked");
this.photos.splice(index, 1);
}
}
]
});
confirm.present();
}
takePhoto() {
//console.log("coming here");
const options: CameraOptions = {
quality: 50,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
};
this.camera.getPicture(options).then(
imageData => {
this.base64Image = "data:image/jpeg;base64," + imageData;
this.photos.push(this.base64Image);
this.photos.reverse();
this.imageUpload=imageData;
},
err => {
console.log(err);
}
);
}
/*PARTIE PHOTO FIN*/
When i don’t send picture, all the others informations are sent without problem. Only when i add picture that i have this problem…
Any help ??