Upload
wx.chooseMessageFile({
count: 1,
type: 'file',
success (res) {
console.log(res)
const tempFilePaths = res.tempFiles[0].path
wx.uploadFile({
url: "https://api110.",
//herbplantist.com/sucai/public/index.php/post/post/uploadFile
filePath: tempFilePaths,
name: 'file',
formData: {
key: 'Gn1xVdBiTClSSHKZifg0pTQSU5XGagWO',
is_https: 1,
},
success(resp) {
var info = JSON.parse(resp.data)
console.log(info.info.url)
},
})
}
})
download file
dopuWrod(){
wx.downloadFile({
// 示例 url,并非真实存在
url: 'https://sucai.suoluomei.cn/sucai_zs/file/20200909101044-12.xls',
success: function (res) {
console.log(res)
const filePath = res.tempFilePath
wx.openDocument({
filePath: filePath,
showMenu:true,
success: function (res) {
console.log('打开文档成功')
}
})
}
})
},