feat: update ppid data files services

This commit is contained in:
hanif salafi 2024-05-15 23:21:29 +07:00
parent caeb784a7f
commit 74bf64bbd7
1 changed files with 2 additions and 1 deletions

View File

@ -110,6 +110,7 @@ func (_i *ppidDataFilesService) Save(c *fiber.Ctx) (err error) {
defer src.Close()
filename := filepath.Base(file.Filename)
filename = strings.ReplaceAll(filename, " ", "")
filenameWithoutExt := filepath.Clean(filename[:len(filename)-len(filepath.Ext(filename))])
extension := filepath.Ext(file.Filename)[1:]
@ -118,8 +119,8 @@ func (_i *ppidDataFilesService) Save(c *fiber.Ctx) (err error) {
newFilenameWithoutExt := filenameWithoutExt + "_" + strconv.Itoa(randUniqueId)
newFilename := newFilenameWithoutExt + "." + extension
objectName := "ppid/upload/" + newFilename
size := strconv.FormatInt(file.Size, 10)
statusId := 1