收藏
回答

downloadFile下载image显示失败 wxfile.open

我目的是下载一张图片,然后显示在image标签里面。

var ufpath = app.globalData.hostName + vdata.data.filePath;
console.log('down  path is ' + ufpath)
wx.downloadFile({
    url: ufpath, //仅为示例,并非真实的资源
    success: function(res) {
        console.log('down down  path is ' + ufpath)
        console.log('down temp file ' + res.tempFilePath)
        var tempimg = res.tempFilePath;
        that.setData({
            FilePath:tempimg,
            // showface:true
        })

<image bindtap="bindPreImg" data-imgsrc="{{FilePath}}" mode="aspectFit" src="{{FilePath}}">
</image>


打印日志:

down down  path is http://127.0.0.1:8360/static/camera/1493360555.jpg
 
camera.js [sm]:66 down temp file wxfile://tmp_547422841o6zAJs2O8-DtLIa4JjqF5v2SN6Oob41ba5d358816e21e53aa11cb8f1c943.jpg
 
 
VM5393:1 Fri Apr 28 2017 14:22:36 GMT+0800 (CST) 渲染层网络层错误
VM5393:2 Failed to load image http://wxfile.open.weixin.qq.com/tmp_547422841o6zAJs2O8-DtLIa4JjqF5v2SN6Oob41ba5d358816e21e53aa11cb8f1c943.jpg : the server responded with a status of 404 (HTTP/1.1 404 Not Found)
From server 127.0.0.1



为什么会出现这种错误?

VM5393:2 Failed to load image http://wxfile.open.weixin.qq.com/tmp_547422841o6zAJs2O8-DtLIa4JjqF5v2SN6Oob41ba5d358816e21e53aa11cb8f1c943.jpg : the server responded with a status of 404 (HTTP/1.1 404 Not Found) 

From server 127.0.0.1


回答关注问题邀请回答
收藏

11 个回答

  • Lucifer
    Lucifer
    2017-04-28

    真机测试也没有看到图片。downloadFile的url是有图片的。就是到了wxfile这个路径就无法显示。

    2017-04-28
    有用
    回复

正在加载...

登录 后发表内容