Open bigbao9494 opened 1 year ago
I would suggest that
This is the usage method in Golang, you can refer to it:
func upload_file(writer http.ResponseWriter, request *http.Request) {
//only FormData
if len(r.MultipartForm.Value) > 0 {
fmt.Println(r.MultipartForm.Value["hello"])
fmt.Println(r.MultipartForm.Value["post"])
}
//FormData and URLData
if len(request.Form) > 0 {
for key, val := range request.Form {
fmt.Println(key, val, reflect.TypeOf(val))
}
}
filename := request.MultipartForm.File["file"][0].Filename
fileHeader := request.MultipartForm.File["file"][0]
file, err := fileHeader.Open()
}
Thanks for the good suggestions!
@yhirose ,hi yhirose ,how about this featuer?
@bigbao9494, I don't have the time to work on it right now, but I keep it as 'enhancement'. Of course, a pull request is always welcome!
A better way of accessing form fields