Hi everyone, I’ve got a problem with my application developed with ionic 3.
The application was finished, but after a few months the person I developed the app for wanted to make some changes and now the app doesn’t work only in part.
Particularly when I send an image with POST request to the server I always get back an error. I didn’t have this problem before. Here the code:
this.http.post('https://www.domainame.com', {richiesta: 'registraUtenteCliente', parameters: param}, {}) //param contains all information for registration
.then(data => {
this.nativeStorage.setItem("infoItem", {name: this.nome, surname: this.cognome, phone: this.telefono})
.then(
() => console.log("Salvato nuovo cliente"),
error => console.log('Errore ' + error));
this.navCtrl.push(HomePage);
},
error => alert("errore"));
var image = this.base64Image.replace("data:image/jpeg;base64,","");
this.http.post('https://www.albergoromagna.cloud', {richiesta: 'registraFotoCliente', numero: this.telefono,
immagine : image},{}).then(
data => console.log(),
error => alert("errore"));
const loader = this.loadingCtrl.create({
content: "Caricamento...",
duration: 4000
});
loader.present();
In the first request I send to the server all the parameters for the registration and that’s all ok, after I send the photo catch with native camera plugin, and I get back the error. It seems that the server is not responding, but if I send the photo with postman the server responds correctly. I tried to remove android platform and plugin directory, and when i build for android sometimes it works. When it works if I rebuild again, the image post request will fail again.
I don’t want to delete plugins and remove android platform every time because sometimes it works and sometimes it doesn’t. I think it is a problem with node. Does anyone know how to fix this problem?