收藏
回答

uploadFile:fail Error: socket hang up

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

回答关注问题邀请回答
收藏
登录 后发表内容