refactor: Replace Request.FormFile

This commit is contained in:
정주현 2023-04-25 15:29:32 +09:00
parent a889c58de7
commit 8c5e6b48d0

View File

@ -581,12 +581,12 @@ func (c *Context) FormFile(name string) (*multipart.FileHeader, error) {
return nil, err
}
}
f, fh, err := c.Request.FormFile(name)
if err != nil {
return nil, err
if c.Request.MultipartForm != nil && c.Request.MultipartForm.File != nil {
if fhs := c.Request.MultipartForm.File[name]; len(fhs) > 0 {
return fhs[0], nil
}
f.Close()
return fh, err
}
return nil, http.ErrMissingFile
}
// MultipartForm is the parsed multipart form, including file uploads.