1
0
mirror of https://github.com/labstack/echo.git synced 2025-11-06 08:59:21 +02:00
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2015-11-16 07:57:40 -08:00
parent 0163cddab5
commit f09efac326
3 changed files with 41 additions and 13 deletions

View File

@@ -12,6 +12,28 @@ menu:
Use `req.ParseMultipartForm(16 << 20)` for manually parsing multipart form. It gives
us an option to specify the maximum memory used while parsing the request body.
If you just want to upload a single file:
```go
file, fh, err := req.FormFile("file")
if err != nil {
return err
}
defer file.Close()
// Destination
dst, err := os.Create(fh.Filename)
if err != nil {
return err
}
defer dst.Close()
// Copy
if _, err = io.Copy(dst, file); err != nil {
return err
}
```
### Server
`server.go`