uploadFile:fail Error: socket hang up
发布于 6 年前 作者 mingwang 2720 次浏览 来自 问答

wx.chooseImage({

            count: 1,

            sizeType: [‘original’, ‘compressed’],

            sourceType: [‘album’, ‘camera’],

            success: function (res) {

 

                that.setData({

                    avatarUrl: that.data.avatarUrl.concat(res.tempFilePaths[0])

                })

                wx.uploadFile({

                    url: app.globalData.apiurl + ‘WxAPI/UpImgWx.ashx?type=2’,

                    filePath: res.tempFilePaths[0],

                    name: ‘images’,

                    formData: {

 

                    },

                    success(res) {

                        console.log(that.data.res);

                    },

                    fail: function (res) {

                        console.log(res);

                    }

                });

            },

            fail: function (res){

                console.log(res);

            }

        })

然后就报 uploadFile:fail Error: socket hang up

回到顶部