wx.uploadFile上传图片问题
发布于 6 年前 作者 kyin 7513 次浏览 来自 问答

现在wx.uploadFile上传图片的大小是不是做了限制啊,为什么我上传图片都到不了我的服务器啊???

wx.chooseImage({

count: 1, // 默认9

sizeType: [‘original’, ‘compressed’], // 可以指定是原图还是压缩图,默认二者都有

sourceType: [‘album’, ‘camera’], // 可以指定来源是相册还是相机,默认二者都有

success: function (res) {

// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片

_this.setData({

tempFilePaths: res.tempFilePaths

})

var tempFilePath = res.tempFilePaths[0];

// console.log(_this.data.index)

wx.uploadFile({

url: https://xxxxxxxx,

filePath: tempFilePath,

name: ‘images’,

formData:{

num: 5,

ctype: _this.data.index,

},

success: function(res){

wx.setStorage({

key: ‘image’,

data: res.data,

success: function(res){

wx.navigateTo({

url: ‘…/image/image?img=’ + tempFilePath,

})

}

})

}

})

2 回复

问题是都没有到服务器端啊,我服务器端没有接到访问请求啊

如果能选择成功并返回临时路径的话,应该是服务器端做了限制。

回到顶部