1***@qq.com
1***@qq.com
  • 发布:2020-11-06 14:41
  • 更新:2022-03-11 09:30
  • 阅读:1087

uni.uploadFile上传uni.createLivePusherContext.snapshot 返回的图片地址后台无法正常获取

分类:uni-app

uni.createLivePusherContext.snapshot 返回的图片地址,是否可以直接通过uni.uploadFile去上传?
我尝试了一下,小程序上,这样没有问题,APP拿到的相对路径无法直接uploadFile,后台直接报错了
贴下我的代码:
getsnapshot() {
this.myLP.snapshot({
success: a => {
var tempFilePath = a.tempImagePath || a.message.tempImagePath;
setTimeout(()=>{
uni.showLoading({
title:'识别中...'
})
that.saveFace(tempFilePath)
},500)
}
})
},
saveFace(tempFilePath)
var url = getApp().serverUrl
uni.uploadFile({
url: url + 'buildingworkerservice/AIFace/match',
filePath: tempFilePath,
sizeType:'compressed',
fileType:'image',
name: 'file',
header:{
Authorization:uni.getStorageSync('token')
},
success(res) {
uni.hideLoading()
console.log(res)
}
})
}

2020-11-06 14:41 负责人:无 分享
已邀请:
c***@foxmail.com

c***@foxmail.com

你好请问解决了吗?我也想这么干来着,也失败了,还有别的办法吗

  • 1***@qq.com (作者)

    没有解决,我是拿到base64码传给服务器的

    2021-01-21 12:00

z***@163.com

z***@163.com

这个问题 没人解答一下吗

  • 1***@qq.com (作者)

    没有解决,我是拿到base64码传给服务器的

    2021-01-21 12:01

4***@qq.com

4***@qq.com - 搬砖的

使用plus.io.convertAbsoluteFileSystem(tempImagePath) 转换一下,在上传

3***@qq.com

3***@qq.com

现在uploadFile能正常上传快照文件

该问题目前已经被锁定, 无法添加新回复