Skip to content

Commit 43344ff

Browse files
committed
fea: 上传文件
1 parent 1140f75 commit 43344ff

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

bootstrap/services/filesystem/local.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"github.com/go-home-admin/home/app"
66
uuid "github.com/satori/go.uuid"
77
"os"
8+
"path"
89
"strings"
910
)
1011

@@ -34,7 +35,7 @@ func (l *Local) FormFile(c *gin.Context, up, to string) (string, error) {
3435
return "", err
3536
}
3637
}
37-
newFileName := uuid.NewV4().String()
38+
newFileName := uuid.NewV4().String() + "." + path.Ext(file.Filename)
3839
// 拼接目标文件路径
3940
dst = dst + "/" + newFileName
4041
dst = strings.ReplaceAll(dst, "//", "")

0 commit comments

Comments
 (0)