月光寺冰 2021-05-19 20:46 采纳率: 100%
浏览 108
已采纳

微信小程序上传百度AI上识别图片编码base64失败是怎么回事啊?

百度AI要图片为base64编码的,我用filesystemmanager.ReadFile总是返回的是fail
也不报错
使用的是微信开发者工具,JS后台

wx.chooseImage({
      
      sizeType: ['original', 'compressed'],
      sourceType: [type],
      success: function (res) {
      
        var tempFilePaths = res.tempFilePaths
        that.tempFilePath = tempFilePaths
        //console.log(tempFilePaths)
        //that.getkey(res.data)
        wx.getFileSystemManager().readFile({
          
          filePath:tempFilePaths,
          encoding:'base64',
          //decoding:"base64",
          success:res=>{
            console.log(res.data)
            //that.getkey(res.data)
           
          },
          fail:res=>{
            console.log('fail')
            wx.hideLoading();
            wx.showToast({
              title: '拍照失败',
              icon: "none"
            })
            

          }
        
        })


 

  • 写回答

3条回答 默认 最新

  • CSDN专家-林老师 2021-05-19 20:52
    关注

     

     

    wx.chooseImage(Object object)的success回调返回的tempFilePaths是一个数组哦。。。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 用C语言输入方程怎么
  • ¥15 网站显示不安全连接问题
  • ¥15 github训练的模型参数无法下载
  • ¥15 51单片机显示器问题
  • ¥20 关于#qt#的问题:Qt代码的移植问题
  • ¥50 求图像处理的matlab方案
  • ¥50 winform中使用edge的Kiosk模式
  • ¥15 关于#python#的问题:功能监听网页
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题