wx.getFileSystemManager().readFile binary camera标
uploadFileOpt: function (tempImagePath) {//上传图片 api.showLoading('上传中...') let path = tempImagePath console.log(path) console.log(Url.config.apiUrl_upload+'attachment/file/upload') var list = path.split('.') wx.getFileSystemManager().readFile({ filePath: path, //选择图片返回的相对路径 encoding: 'binary', //编码格式 success: res => { //成功的回调 console.log(res) console.log(res.data) [图片][图片]//这是正确的上传方式(在h5内) // 不知道我展现的问题方式对不对,大佬看懂了吗? console.log(encodeURI(res.data)) wx.request({ url: Url.config.apiUrl_upload+'attachment/file/upload', //仅为示例,并非真实的接口地址 header: { 'content-type': 'multipart/form-data; boundary=XXX', // 默认值 // "accept": "utf-8", }, method:"POST", data:'\r\n--XXX' + '\r\nContent-Disposition: form-data; name="files"' + '\r\n' + '\r\n' + res.data + '\r\n--XXX' + '\r\nContent-Disposition: form-data; name="formats"' + '\r\n' + '\r\n'+ ['.'+list[list.length-1]] + '\r\n--XXX--', success (res) { console.log(res) } }) } }) },