- wx.uploadFile接口上传jpg图片, content-type类型错误
出现的问题: 通过wx.chooseImage获取的图片(压缩或原图), 如果图片为jpg格式, 通过wx.uploadFile上传的图片的content-type类型为image/jpg, 正确类型是image/jpeg . 复现的步骤: 选择图片, 图片是压缩的或者是jpg原图 [代码]wx.chooseImage({[代码][代码] count: 1, [代码][代码] sizeType: [[代码][代码]'original'[代码][代码], [代码][代码]'compressed'[代码][代码]], [代码][代码] sourceType: [[代码][代码]'album'[代码][代码], [代码][代码]'camera'[代码][代码]],[代码][代码] success: [代码][代码]function[代码] [代码](res) {[代码][代码] var[代码] [代码]tempFilePaths = res.tempFilePaths[代码][代码] that.setData({ cover: tempFilePaths})[代码][代码] }[代码][代码] })[代码] 上传图片, 后台是微信优惠券的图片服务器 [代码][代码] var path = this.data.cover [代码]wx.uploadFile({[代码] [代码] [代码][代码]url: [代码][代码]''[代码][代码],[代码][代码] [代码][代码]filePath: path[0],[代码][代码] [代码][代码]name: [代码][代码]'image'[代码][代码],[代码][代码] [代码][代码]header: {[代码][代码] [代码][代码]"Content-Type"[代码][代码]: [代码][代码]"multipart/form-data;"[代码][代码],[代码][代码] [代码][代码]},[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]var[代码] [代码]data = res.data[代码][代码] [代码][代码]console.log(res.data)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码] 抓包发现, 凡是jpg的图片的content-type都是image/jpg, 一般服务端都是以image/jpeg来处理jpg图片的, 导致图片上传失败
2017-12-08 - canvas ctx.font设置斜体真机上无效果
在客户端查看正常 [图片] 手机查看无效果 [图片] 设置为: [图片]
2018-06-28