]> saetta.ns0.it Git - zakegg_go/commitdiff
Allegati: aggiunta entropia al nome file temp.
authorAndrea Zagli <azagli@libero.it>
Thu, 11 Aug 2022 09:41:24 +0000 (11:41 +0200)
committerAndrea Zagli <azagli@libero.it>
Thu, 11 Aug 2022 09:41:24 +0000 (11:41 +0200)
allegati.go

index f49d33ca00416e38adebfeee4c1f110363928843..19cc5ab976967a5d823e51389f36349d168d9d2d 100644 (file)
@@ -32,11 +32,14 @@ func AllegatoSalva(allegati_dir string, file multipart.File, file_header *multip
 
        ora := time.Now()
        filename := filepath.Join(allegati_dir,
-               fmt.Sprintf("%d%02d%02d%02d-%s",
+               fmt.Sprintf("%04d%02d%02d%02d%02d%02d%02d-%s",
                        ora.Year(),
                        ora.Month(),
                        ora.Day(),
-                       rand.Intn(10),
+                       ora.Hour(),
+                       ora.Minute(),
+                       ora.Second(),
+                       rand.Intn(99),
                        file_header.Filename))
 
        tmpfile, err := os.Create(filename)