I'm creating an API for uploading images to MinIO server and I need to send files in the request body. Then I need to get the file and pass io.Reader type variable into a function that will add it to the bucket. I don't know what data type I have to put in the body struct for this field. Any suggestions?
CodePudding user response:
Okay, I actually figured it out:
type Body struct {
recipe_id string `form:"recipe_id"`
image *multipart.FileHeader `form:"file"`
}
file_header, err := c.FormFile("file")
file, err := file_header.Open()