Download

Transfers the file from path as an attachment.

Typically, browsers will prompt the user to download. By default, the Content-Disposition header filename= parameter is the file path (this typically appears in the browser dialog).

Override this default with the filename parameter.

  1. func (c *Ctx) Download(file string, filename ...string) error
  1. app.Get("/", func(c *fiber.Ctx) error {
  2. return c.Download("./files/report-12345.pdf");
  3. // => Download report-12345.pdf
  4. return c.Download("./files/report-12345.pdf", "report.pdf");
  5. // => Download report.pdf
  6. })