diff --git a/src/framework/utils/file/file.go b/src/framework/utils/file/file.go index 51854149..8470fc98 100644 --- a/src/framework/utils/file/file.go +++ b/src/framework/utils/file/file.go @@ -317,7 +317,7 @@ func CopyUploadFile(filePath, dst string) error { } // 如果目标文件已经存在,先将目标文件重命名 - if _, err := os.Stat(dst); err == nil { + if info, err := os.Stat(dst); err == nil && !info.IsDir() { ext := filepath.Ext(dst) name := dst[0 : len(dst)-len(ext)] newName := fmt.Sprintf("%s-%s%s", name, time.Now().Format("20060102_150405"), ext)