当我从图库中选择一张照片时,我收到一个错误,它将警报显示为“服务器错误”。请帮我解决我的问题> _<我正在使用Image Picker和cordova文件传输
upload(){
ImagePicker.getPictures({
maximumImagesCount: 1,
width: 127,
height: 127,
quality: 75
}).then((results) => {
for (var i = 0; i < results.length; i++) {
var url = "http://ifund.esy.es/register.php"
var targetPath = results[i];
// File name only
var filename = targetPath.split("/").pop();
const fileTransfer = new Transfer();
var options = {
fileKey: "file",
fileName: filename,
chunkedMode: false,
mimeType: "image/jpg",
params: {'directory': 'upload', 'fileName': filename, 'username': this.username, 'password': this.password, 'first_name': this.fname, 'last_name': this.lname, 'email': this.email, 'address': this.address, 'contact': this.contact, 'bday': this.bday}
};
fileTransfer.upload(url, targetPath, options).then((results) => {
alert('file uploaded successfully ' + results);
}, error => {
alert('server error');
});
}
}, (err) => {
let alert = this.alert.create({
title:'Warning',
subTitle: "ERROR",
buttons: ['OK']
})
alert.present(); });