upLoad(item) {
var that = this;
uni.chooseImage({
count: 1,
success: function(res) {
uni.showLoading({
title: '上传中'
});
uni.uploadFile({
url: 'https://www.baidu.com',
header: {
Authorization: uni.getStorageSync('token'),
'content-type': 'multipart/form-data'
},
method: 'post',
fileType: 'image',
name: 'uploadfile',
filePath: res.tempFilePaths[0],
success: res => {
// var urlStr =
// JSON.parse(res.data).data.path.substr(0, 15) +
// '...' +
// JSON.parse(res.data).data.path.substr(55);
uni.hideLoading();
},
fail: err => {
uni.hideLoading();
}
});
}
});
},
小程序附件上传
于 2023-02-28 09:12:11 首次发布