From ba802462ed79faeeda11e18f562b980e81e35ef1 Mon Sep 17 00:00:00 2001 From: louwenzhi Date: Wed, 31 Mar 2021 10:52:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/controllers/common/CommonUploadPic.rest.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/controllers/common/CommonUploadPic.rest.go b/web/controllers/common/CommonUploadPic.rest.go index affeca4..8c542d6 100644 --- a/web/controllers/common/CommonUploadPic.rest.go +++ b/web/controllers/common/CommonUploadPic.rest.go @@ -56,9 +56,11 @@ func RegisterUploadMustPic(party router.Party, httpMethod string, path string, m var uploadfiles []string for _, file := range files { if !utils.ValueIsEmpty(file.Filename) { + filename := strings.Split(file.Filename,".") + filetype := filename[1] guid := utils.MakeOrderSn(user.Userid) - filPath := "public/uploadfile/" + guid + ".jpg" - savePath := "web/public/uploadfile/" + guid + ".jpg" + filPath := "public/uploadfile/" + guid + "." +filetype + savePath := "web/public/uploadfile/" + guid + "." +filetype // 上传文件至指定目录 err := utils.SaveUploadedFile(file, savePath) if err != nil {