FormFile returns the first uploaded file that received from the client. The default form's memory maximum size is 32MB, it can be changed by the `iris#WithPostMaxMemory` configurator at main configuration passed on `app.Run`'s second argument. Example: https://github.com/kataras/iris/tree/main/_ex
(key string)
| 2329 | // |
| 2330 | // Example: https://github.com/kataras/iris/tree/main/_examples/file-server/upload-file |
| 2331 | func (ctx *Context) FormFile(key string) (multipart.File, *multipart.FileHeader, error) { |
| 2332 | // we don't have access to see if the request is body stream |
| 2333 | // and then the ParseMultipartForm can be useless |
| 2334 | // here but do it in order to apply the post limit, |
| 2335 | // the internal request.FormFile will not do it if that's filled |
| 2336 | // and it's not a stream body. |
| 2337 | if err := ctx.request.ParseMultipartForm(ctx.app.ConfigurationReadOnly().GetPostMaxMemory()); err != nil { |
| 2338 | return nil, nil, err |
| 2339 | } |
| 2340 | |
| 2341 | return ctx.request.FormFile(key) |
| 2342 | } |
| 2343 | |
| 2344 | // FormFiles same as FormFile but may return multiple file inputs based on a key, e.g. "files[]". |
| 2345 | func (ctx *Context) FormFiles(key string, before ...func(*Context, *multipart.FileHeader) bool) (files []multipart.File, headers []*multipart.FileHeader, err error) { |
no test coverage detected