作者 唐旭辉

文件上传修改

... ... @@ -33,7 +33,7 @@ ucenter_app_key = "39aefef9e22744a3b2d2d3791824ae7b"
ucenter_secret = "cykbjnfqgctn"
# 上传文件保存路径
file_save_path = "/var/www/oppmg/file"
file_save_path = "/var/www/oppmg/file/opportunity"
file_host = "http://mmm-oppmg-dev.fjmaimaimai.com"
file_host_path = "/file/opp"
... ...
... ... @@ -58,7 +58,7 @@ func saveFile(fileData *multipart.FileHeader, fileType string) (hostpath string,
}
subfix := path.Ext(fileData.Filename)
mfileName := fmt.Sprint(utils.GenerateIDBySonyflake())
mfileName = fmt.Sprintf("%d_%s%s", time.Now().Unix(), mfileName, subfix)
mfileName = fmt.Sprintf("%d_%s.%s", time.Now().Unix(), mfileName, subfix)
log.Debug("文件保存地址%s", filepath.Join(savepath, mfileName))
dst, err := os.Create(filepath.Join(savepath, mfileName))
defer dst.Close()
... ...