- 发布文章关联公众号链接报错,如何解决?
【公众号】: 洞察美股 【浏览器UA】: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0 【页面链接】: https://mp.weixin.qq.com/cgi-bin/appmsg?t=media/appmsg_edit_v2&action=edit&isNew=1&type=10&token=2119618002&lang=zh_CN×tamp=1709254741528 【问题描述】: 请描述问题发生时的操作步骤,并最好能附出现问题的截图 [图片]
2024-03-01 - wx.uploadFile文件上传 小于2M文件上传正常,大于2M报错,需使用哪个api解决该问题?
上传文件大于2M,提示错误信息,(提示与json格式无关,是api内部限制了上传文件大小),需用哪个api能解决上传文件大小问题(上传文件格式,pdf,word,xlsx,ppt) Unexpected token < in JSON at position 0;at api uploadFile success callback function SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at success (http://127.0.0.1:15704/appservice/pages/panel/panel.js:264:32) [图片] 附代码: wx.chooseMessageFile({ count: 1, //type: 'file', success(res) { // tempFilePath可以作为img标签的src属性显示图片 console.log("res:", res) const tempFiles = res.tempFiles; var fileinfo = tempFiles[0]// tempFiles[idx] console.log("fileinfo:", fileinfo); wx.uploadFile({ header: { 'content-type': 'multipart/form-data', //'Content-Type': 'application/x-www-form-urlencoded' }, // method: 'POST', // header: { 'content-type': 'application/x-www-form-urlencoded' }, url: constant.root_upload_url, filePath: fileinfo['path'], name: 'file', formData: { 'userid': userid, 'menuid': currentMenuId, 'filename': fileinfo['name'], }, success(res) { const t_data = res.data var jsonObj = JSON.parse(t_data); //刷新文件列表 if (!jsonObj['errorFlag']) { wx.showModal({ title: '提示信息', content: jsonObj.errorMsg, }) } else { //上传成功,刷新文件列表 that.reloadFolderList(currentMenuId); } }, error(error) { console.log("error:", error) wx.showModal({ title: '提示信息', content: '抱歉,数据解析异常,请稍后重试!', }) //do something } } ) // }
2019-11-15