难道还没有说法?我现在也有这个问题,很困惑
微信小程序上传图片到对象存储官方给推荐一种方式呗!! 微信小程序上传图片到云对象存储 利用url 总是报错 <Error> <Code>MalformedPOSTRequest</Code> <Message>The body of your POST request is not well-formed multipart/form-data.</Message> <Resource>##########.cos.ap-beijing.myqcloud.com/460/head2.jpg</Resource> <RequestId>NWE5OGRlOTJfNGEyODVkNjRfMTUwOTVfMjkxNWM1</RequestId> <TraceId>OGVmYzZiMmQzYjA2OWNhODk0NTRkMTBiOWVmMDAxODc0OWRkZjk0ZDM1NmI1M2E2MTRlY2MzZDhmNmI5MWI1OTI5MWRkM2I1ZDU3ZWE5Y2YzNDYzZTEzY2JlMjU3NDQ0ZjA4ODgyZWI5YjU1MDQ5MDFjZDY4MTAzMjg3ZWM2MTU=</TraceId> </Error> 不知道什么原因啊!!
2019-05-18我也有这个问题,请问解决了吗?
直接从小程序上传图片到COS我想知道这是可能到吗?我一直得到报错“The body of your POST request is not well-formed multipart/form-data.” 我用一个云函数计算所需要到Auth,返还这个Auth给微信小程序后我想直接用wx.uploadFile上传图片到COS。以下是我实际的代码 [代码]wx.uploadFile({[代码] [代码] [代码][代码]url: [代码][代码]"https://bucketname-appid.cos.ap-guangzhou.myqcloud.com"[代码][代码],[代码] [代码] [代码][代码]filePath: [代码][代码]this[代码][代码].data.imgSrc, // 这个imgSrc看起来是这样的 http://tmp/wx06831dfa43ec02c8.tGEdCWwps.6OYqN...jHa01.jpg[代码] [代码] [代码][代码]name: [代码][代码]'file'[代码][代码],[代码] [代码] [代码][代码]header: {[代码] [代码] [代码][代码]'Authorization'[代码][代码]: resData.data, // 这里的data看起来是这样的 q-sign-algorithm=sha1&q-ak=AKIDK1a...&q-sign-time=1538223445;1538222464&q-key-time=1538223445;1538222464&q-header-list=&q-url-param-list=&q-signature=23b157...[代码] [代码] [代码][代码]"Content-Type"[代码][代码]: [代码][代码]"multipart/form-data"[代码][代码],[代码] [代码] [代码][代码]'Host'[代码][代码]: [代码][代码]"bucketname-appid.cos.ap-guangzhou.myqcloud.com"[代码] [代码] [代码][代码]},[代码] [代码] [代码][代码]success: [代码][代码]function[代码] [代码](uploadRes) {[代码] [代码] [代码][代码]console.log([代码][代码]'ssss::: '[代码][代码], uploadRes)[代码] [代码] [代码][代码]},[代码] [代码] [代码][代码]fail: [代码][代码]function[代码] [代码](e) {[代码] [代码] [代码][代码]console.log([代码][代码]'e'[代码][代码], e)[代码] [代码] [代码][代码]}[代码] [代码]});[代码]**我用“bucketname-appid"代替了真实的bucketname和appid 这段代码会运行success中的callback,console.log显示如下 data:"<?xml version='1.0' encoding='utf-8' ?>↵<Error>↵ <Code>MalformedPOSTRequest</Code>↵ <Message>The body of your POST request is not well-formed multipart/form-data.</Message>↵ <Resource>bucketname-appid.cos.ap-guangzhou.myqcloud.com</Resource>↵ <RequestId>NWJh....FiMTc=</RequestId>↵ <TraceId>OGVm...gzMzdjOTA=</TraceId>↵</Error>↵↵" errMsg:"uploadFile:ok" statusCode:400
2019-05-18