'I add file to my API and got invalid character '-' in numeric literal in POST API
I know this code need to send a JSON instead of form data in the API
err := ctx.ShouldBindJSON(&modelAdd)
if err != nil {
return err
}
But I need to add file, is there anything like ShouldBindJSON but for FormData?
Solution 1:[1]
You can use ShouldBind
to get data from form data as the documentation says
https://github.com/gin-gonic/gin#model-binding-and-validation
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Miguel Vieira Colombo |