wx.chooseMessageFile 成功返回 的数组为空 没取到path 按理说成功了进去success应该可以拿到
wx.chooseMessageFilewx.chooseMessageFile({ count: 1, type: 'file', [代码] success(res) { const tempFilePaths = res.tempFiles; console.log(res, 'res', tempFilePaths, 'template'); wx.uploadFile({ url: UPDATEFILEURL, // 仅为示例,非真实的接口地址 filePath: tempFilePaths[0].path, name: 'resume', formData: { resumeId: that.data.resume_id, file_name: tempFilePaths[0].name }, header: { cookie: wx.getStorageSync("cookie"), }, success(res) { const data = res.data; console.log(res, '成功'); res = JSON.parse(res.data) if (res.result == 'success') { that.getAjax(true); $Toast({ content: '上传成功', type: 'success' }); } else { $Toast({ content: res.message, type: 'error' }) } // do something }, fail(res) { console.log(res, '失败'); } }) }, fail(res) { console.log(res, '选择文件失败'); } })[代码] [图片]
2019-05-28