我想使用API使用Ionic 3 Angular 5上传照片。但是我无法从客户端到服务器端获取$ _FILES ['file'] ['name']。
uploadPhoto2() {
let loader = this.loadingCtrl.create({
spinner: 'crescent',
dismissOnPageChange: true
});
loader.present();
this.group_id = 0;
this.media.tags = this.hashes;
this.media.img = this.image;
this.userData.uploadPhoto(this.media,this.group_id)
.map(res => res.json())
.subscribe(data => {
loader.dismiss();
console.log(this.media);
if (data.success) {
swal({
icon: "success",
text: data.message,
buttons: {
visible: false
}
});
}
else {
swal({
icon: "error",
text: data.error,
buttons: {
visible: false
}
});
}
},
err => {
loader.dismiss();
alert('An error occurred, please check your internet connection');
});
}
我想将其发送到api,apo可以正常工作,我做了回显,但没有显示回显$ _FILES ['file'] ['name']; exit;如何将其发送到服务器端?