我想在我的go-gin应用程序中创建一个用于上传图像的api。这是我当前的api代码:
func (s *Service) ImageCreate(c *gin.Context) {
token := c.MustGet(tokenKey).(*models.Token)
now := time.Now()
file, err := c.FormFile("file")
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "01> " + err.Error()})
return
}
}当我从浏览器调用我的应用程序时,它返回以下错误:
{"error":"01\u003e invalid URL escape \"%$\\xf4\""}在postman api中,它工作正常,没有错误。怎么啦?我如何为浏览器修复它?
发布于 2019-03-13 16:23:30
不要使用邮递员。
curl -X POST http://localhost:8080/server-image/upload-file -F "file=@/Users/shikuanxu/Downloads/images/course-outline.png" -H "Content-Type: multipart/form-data"再试试
https://stackoverflow.com/questions/54678765
复制相似问题