I've been struggle a lot with extracting form values from a multipart request form in Go. The form contains x number of key : values and also a file.
The parts do exist in the BODY when I print the whole body.
Alternative 1:
func(w http.ResponseWriter, r *http.Request) {
r.ParseMultipartForm(0)
fmt.Println(r.FormValue("key"))
}
This returns only empty values.
Alternative 2:
My second approach was to do something like this with MultipartReader():
However, this give me "unexpected EOF" before getting the last value with FormValue(). It does however print 9/10 values.
Can someone with more experience with Go give some hints how to fix this? And yes, I think I've searched the whole net for a solution now. Nothing seems to work.
Thanks.