replace complete filename

This commit is contained in:
Simon Rieger 2024-04-01 14:40:21 +02:00
parent 1078e3d3e0
commit f5048a09f1

View file

@ -126,9 +126,12 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
if forceName == "true" {
filename = handler.Filename
} else {
// Extrahiere nur die Dateiendung
fileExtension := filepath.Ext(handler.Filename)
// Zeitstempel zum Dateinamen hinzufügen
timestamp := time.Now().Format("20060102-150405")
filename = fmt.Sprintf("%s-%s", timestamp, handler.Filename)
filename = fmt.Sprintf("%s%s", timestamp, fileExtension)
}
// Datei speichern