media data missing hint

错误提示:
{"errcode":41005,"errmsg":"media data missing hint: [0363e547]"}

上传方法参考:https://github.com/node-webot...

const request = require('co-request')
const formstream = require('formstream')

const filepath = __dirname + '/123.jpg'
    var stat = fs.statSync(filepath);
    var form = formstream()
    form.file('media', filepath, path.basename(filepath), stat.size);

    var url = 'https://api.weixin.qq.com/cgi-bin/media/upload?' + 'access_token=' + access_token + '&type=image'
    console.log(url);
    var opts = {
      method: 'POST',
      timeout: 60000, // 60秒超时
      headers: form.headers(),
      data: form
    };
    opts.headers.Accept = 'application/json'
    const retData = yield request(url, opts)
    console.log(retData.body)
阅读 5.6k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题