ionic3+angular+html5 developer app, calls local photo albums to upload pictures and failed to upload pictures. When you get to this method: this.fileTransfer.upload (path, this.upload.url, options), success or failure function cannot be called back. Just come into contact with this framework, the webStorm, used by the development tools will be solved by friends.
/ / upload pictures
private uploadImg (path:string, num: number) {
if(!path) {
return;
}
let options:any;
options = {
fileKey: this.upload.fileKey,
fileName: num.toString() + this.houseid + ".jpg",
headers: this.upload.headers,
houseid: this.houseid,
params: this.upload.params
};
this.fileTransfer.upload(path, this.upload.url, options)
.then((data) => {
this.noticeSer.showToast("");
console.log("success " + data.response+ " data "+ data.headers);
}, (err) => {
this.noticeSer.showToast(err.code+"lllllllllllllll");
console.log(":" + err.code + " source url: " + err.source + " target url: " + err.target + " body:" + err.body);
});
}