mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-05 05:07:38 +08:00
30 lines
489 B
Go
30 lines
489 B
Go
package upload
|
|
|
|
import (
|
|
"io"
|
|
"mime/multipart"
|
|
"os"
|
|
)
|
|
|
|
// Upload body info.
|
|
type body struct {
|
|
XFile *os.File
|
|
body io.Reader
|
|
MR *multipart.Reader
|
|
Available bool
|
|
}
|
|
|
|
// Check exists body in xfile and return body.
|
|
func newBody(req_body io.Reader) (*body, error) {
|
|
return &body{body: req_body, Available: true}, nil
|
|
}
|
|
|
|
// Close filehandler of body if XFile exists.
|
|
func (body *body) Close() error {
|
|
if body.XFile != nil {
|
|
return body.XFile.Close()
|
|
}
|
|
|
|
return nil
|
|
}
|