Skip to content

Commit

Permalink
fea: 上传文件
Browse files Browse the repository at this point in the history
  • Loading branch information
cyz-home committed Mar 3, 2023
1 parent 1140f75 commit 43344ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bootstrap/services/filesystem/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/go-home-admin/home/app"
uuid "github.com/satori/go.uuid"
"os"
"path"
"strings"
)

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

0 comments on commit 43344ff

Please sign in to comment.