From: Andrea Zagli Date: Thu, 11 Aug 2022 09:41:24 +0000 (+0200) Subject: Allegati: aggiunta entropia al nome file temp. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=b9050a70214b1a8db1f4158173e5c783de81acda;p=zakegg_go Allegati: aggiunta entropia al nome file temp. --- diff --git a/allegati.go b/allegati.go index f49d33c..19cc5ab 100644 --- a/allegati.go +++ b/allegati.go @@ -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)