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 }