feat(context): add SaveUploadedFile func. (#1022)

* feat(context): add SaveUploadedFile func.

* feat(context): update multiple upload examples.

* style(example): fix gofmt

* fix(example): add missing return
This commit is contained in:
Eason Lin
2017-07-16 11:42:08 +08:00
committed by Bo-Yi Wu
parent 5cb25a6410
commit 93b3a0d7ec
5 changed files with 73 additions and 36 deletions

View File

@ -275,7 +275,10 @@ func main() {
// single file
file, _ := c.FormFile("file")
log.Println(file.Filename)
// Upload the file to specific dst.
// c.SaveUploadedFile(file, dst)
c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!", file.Filename))
})
router.Run(":8080")
@ -304,6 +307,9 @@ func main() {
for _, file := range files {
log.Println(file.Filename)
// Upload the file to specific dst.
// c.SaveUploadedFile(file, dst)
}
c.String(http.StatusOK, fmt.Sprintf("%d files uploaded!", len(files)))
})