FormFile returns the first file for the provided form key.
(name string)
| 696 | |
| 697 | // FormFile returns the first file for the provided form key. |
| 698 | func (c *Context) FormFile(name string) (*multipart.FileHeader, error) { |
| 699 | if c.Request.MultipartForm == nil { |
| 700 | if err := c.Request.ParseMultipartForm(c.engine.MaxMultipartMemory); err != nil { |
| 701 | return nil, err |
| 702 | } |
| 703 | } |
| 704 | f, fh, err := c.Request.FormFile(name) |
| 705 | if err != nil { |
| 706 | return nil, err |
| 707 | } |
| 708 | f.Close() |
| 709 | return fh, err |
| 710 | } |
| 711 | |
| 712 | // MultipartForm is the parsed multipart form, including file uploads. |
| 713 | func (c *Context) MultipartForm() (*multipart.Form, error) { |