doc: change the form name of upload example code (#3076)

This commit is contained in:
phithon 2022-03-15 11:24:17 +08:00 committed by GitHub
parent 5f0b6cdfc4
commit ecadd82592
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -385,7 +385,7 @@ func main() {
router.MaxMultipartMemory = 8 << 20 // 8 MiB router.MaxMultipartMemory = 8 << 20 // 8 MiB
router.POST("/upload", func(c *gin.Context) { router.POST("/upload", func(c *gin.Context) {
// Single file // Single file
file, _ := c.FormFile("Filename") file, _ := c.FormFile("file")
log.Println(file.Filename) log.Println(file.Filename)
// Upload the file to specific dst. // Upload the file to specific dst.
@ -417,7 +417,7 @@ func main() {
router.POST("/upload", func(c *gin.Context) { router.POST("/upload", func(c *gin.Context) {
// Multipart form // Multipart form
form, _ := c.MultipartForm() form, _ := c.MultipartForm()
files := form.File["Filename[]"] files := form.File["upload[]"]
for _, file := range files { for _, file := range files {
log.Println(file.Filename) log.Println(file.Filename)