func UploadFile(c *fiber.Ctx) error {
form, err := c.MultipartForm()
if err != nil {
log.Fatal(err)
}
files := form.File["file"]
for _, file := range files {
fmt.Println(file.Filename)
fmt.Println(math.Ceil(float64(file.Size) / 1024))
err := c.SaveFile(file, fmt.Sprintf("./storage/%s", file.Filename))
if err != nil {
return err
}
}
return c.SendString("Done!")
}
Last active
June 4, 2024 11:16
-
-
Save the-pesar/0831050e82814608e9a18171f9756277 to your computer and use it in GitHub Desktop.
To upload multiple files in formdata Fiber (Go)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment