The formFile function works perfectly but in the docs it´s said that the "FormFile returns the first file for the provided form key". Is there a way of obtaining the several files that an html form with an input like:
<input type="file" name="myfiles" multiple="multiple">
might return?
FormFile is a convenience function. You can manually parse and find the files you are looking for in the MultipartForm.
req.ParseMultipartForm(32 << 20) // 32MB is the default used by FormFile
fhs := req.MultipartForm.File["myfiles"]
for _, fh := range fhs {
f, err := fh.Open()
// f is one of the files
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With