post上传 base64 图片,上传成功后base64会拼接到url上导致请求过长失败?

axios({
      method: 'post',
      url: 'http://193.112.56.202:8001/api/upload/imageData',
      headers: {
        'Access-Control-Allow-Origin': '*',
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      params: {
        imgFile1: rst.base64
      }
    }).then((res) => {
      this.peopleImg = res.data.fileNames[0]
    })
    

我用post上传base64图片,为什么上传成功后base64会拼接到url上?这导致了有时候请求过长而请求失败,什么原因?麻烦大佬解答下,在线等

clipboard.png

阅读 3.1k
1 个回答
axios({
      method: 'post',
      url: 'http://193.112.56.202:8001/api/upload/imageData',
      headers: {
        'Access-Control-Allow-Origin': '*',
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      data: { //此处为post请求用data,get请求用params
        imgFile1: rst.base64
      }
    }).then((res) => {
      this.peopleImg = res.data.fileNames[0]
    })
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题