组件名称: uploadfile ; 版本基础库: 2.14.1
下面是我的上传文件的代码片段, 请问大家上传文件怎么可以获取原文件名呀,而不是'tmp/wxfe6f9123c145d7d9.o6zAJ...''这些字符串 ;
后台接受到的只是微信返回的临时路径;但是后台的文件夹里已经存放了我传的图片和文件,
现在不知道该怎样获取上传的原文件名,
我在小程序端也获取不到,请问大家有什么解决方案吗
wx.chooseImage({
success: (res) => {
const tempFilePaths = res.tempFilePaths
let fileType = this.fileName(tempFilePaths[0]);
wx.uploadFile({
url: globalData.baseUrl + '/system/sysNav/upload',
filePath: tempFilePaths[0],
header:{
'content-type': 'multipart/form-data'
},
name: 'file',
success: (result) => {
let res= JSON.parse(result.data)
console.log(res)
}
})
}
})