安卓正常上传,苹果里我到相册里选了一张20k的图片,服务器都得不到数据,服务器端是PHP,$_FILES居然是空的,下面是简单的代码
openPic(){
var that = this;
uni.chooseImage({
count: 1,
sourceType: ['album', 'camera'],
sizeType: ['compressed'],
success: function(chooseImageRes) {
const tempFilePaths = chooseImageRes.tempFilePaths;
that.photo_path = tempFilePaths[0];
that.compressUploadFile();
}
});
},
async compressUploadFile(category_id) {
var that = this;
var imageUrl = that.photo_path;
console.log(that.photo_path);
const uploadTask = uni.uploadFile({
url: api_path+'a=UserListios&m=upload&category_id='+category_id+'&token=b8663711bc743dae46c43287f52200ae',
header: {
'content-type': 'multipart/form-data'
},
filePath: imageUrl,
name: 'pic',
success: (uploadFileRes) => {
console.log(JSON.stringify(uploadFileRes));
},
fail:(res)=>{
console.log('fail');
},
complete:(res)=>{
console.log('complete');
}
});
}