replace complete filename
This commit is contained in:
parent
1078e3d3e0
commit
f5048a09f1
1 changed files with 4 additions and 1 deletions
|
@ -126,9 +126,12 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if forceName == "true" {
|
if forceName == "true" {
|
||||||
filename = handler.Filename
|
filename = handler.Filename
|
||||||
} else {
|
} else {
|
||||||
|
// Extrahiere nur die Dateiendung
|
||||||
|
fileExtension := filepath.Ext(handler.Filename)
|
||||||
|
|
||||||
// Zeitstempel zum Dateinamen hinzufügen
|
// Zeitstempel zum Dateinamen hinzufügen
|
||||||
timestamp := time.Now().Format("20060102-150405")
|
timestamp := time.Now().Format("20060102-150405")
|
||||||
filename = fmt.Sprintf("%s-%s", timestamp, handler.Filename)
|
filename = fmt.Sprintf("%s%s", timestamp, fileExtension)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Datei speichern
|
// Datei speichern
|
||||||
|
|
Loading…
Reference in a new issue