FormFile

MultipartForm files can be retrieved by name, the first file from the given key is returned.

  1. func (c *Ctx) FormFile(key string) (*multipart.FileHeader, error)
  1. app.Post("/", func(c *fiber.Ctx) error {
  2. // Get first file from form field "document":
  3. file, err := c.FormFile("document")
  4. // Save file to root directory:
  5. return c.SaveFile(file, fmt.Sprintf("./%s", file.Filename))
  6. })