MCPcopy Create free account
hub / github.com/kataras/iris / FormFile

Method FormFile

context/context.go:2331–2342  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

2329//
2330// Example: https://github.com/kataras/iris/tree/main/_examples/file-server/upload-file
2331func (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[]".
2345func (ctx *Context) FormFiles(key string, before ...func(*Context, *multipart.FileHeader) bool) (files []multipart.File, headers []*multipart.FileHeader, err error) {

Callers 4

mainFunction · 0.80
PutByMethod · 0.80
UpdateMovieByIDFunction · 0.80
mainFunction · 0.80

Calls 2

GetPostMaxMemoryMethod · 0.65
ConfigurationReadOnlyMethod · 0.65

Tested by

no test coverage detected