From 629175101409633d3e53d954a31721aa2e735b05 Mon Sep 17 00:00:00 2001 From: chenall Date: Tue, 21 Jul 2020 09:57:13 +0800 Subject: [PATCH] fix ghttp_client upload filename issue #809 --- net/ghttp/ghttp_client_request.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ghttp/ghttp_client_request.go b/net/ghttp/ghttp_client_request.go index eb6e6d78b..45c84c2b7 100644 --- a/net/ghttp/ghttp_client_request.go +++ b/net/ghttp/ghttp_client_request.go @@ -135,7 +135,7 @@ func (c *Client) DoRequest(method, url string, data ...interface{}) (resp *Clien if !gfile.Exists(path) { return nil, errors.New(fmt.Sprintf(`"%s" does not exist`, path)) } - if file, err := writer.CreateFormFile(array[0], path); err == nil { + if file, err := writer.CreateFormFile(array[0], gfile.Basename(path)); err == nil { if f, err := os.Open(path); err == nil { if _, err = io.Copy(file, f); err != nil { f.Close()