From 257aee298e2f689556c5281f8cbda7ac8ab56acd Mon Sep 17 00:00:00 2001 From: zhangxin Date: Tue, 11 May 2021 14:34:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0post=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/request.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/request.go b/utils/request.go index 51c209d..6dbd319 100644 --- a/utils/request.go +++ b/utils/request.go @@ -27,7 +27,7 @@ func GetRequest(url string) (body []byte, err error) { } -func PostFormDataWithSingleFile(url string, filepath string) (body []byte, err error){ +func PostFormDataWithSingleFile(url string, filepath string, filename string) (body []byte, err error){ client := http.Client{} bodyBuf := &bytes.Buffer{} bodyWrite := multipart.NewWriter(bodyBuf) @@ -38,7 +38,7 @@ func PostFormDataWithSingleFile(url string, filepath string) (body []byte, err e } defer file.Close() // file 为key - fileWrite, err := bodyWrite.CreateFormFile("file", "logData") + fileWrite, err := bodyWrite.CreateFormFile("file", filename) if err != nil { return nil, err }