Allow selecting and uploading multiple EPUB files at once
- views/pages.templ: upload input now has "multiple" attribute; page
title/heading updated to plural ("Bücher hochladen"); templ regenerated
- internal/web/handlers.go: uploadSubmit now reads all files from
r.MultipartForm.File["book"] instead of a single r.FormFile, saving
each via a new saveUpload helper; partial failures are reported per
filename while successfully saved files are kept
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -239,7 +239,7 @@ func UploadPage(errMsg string) templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "<section class=\"page-head\"><h2>Buch hochladen</h2></section>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "<section class=\"page-head\"><h2>Bücher hochladen</h2></section>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -262,13 +262,13 @@ func UploadPage(errMsg string) templ.Component {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, " <form method=\"post\" action=\"/upload\" enctype=\"multipart/form-data\" class=\"upload-form\"><label for=\"book\">EPUB auswählen</label> <input id=\"book\" type=\"file\" name=\"book\" accept=\".epub\" required> <button type=\"submit\" class=\"btn\">Hochladen</button></form>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, " <form method=\"post\" action=\"/upload\" enctype=\"multipart/form-data\" class=\"upload-form\"><label for=\"book\">EPUB(s) auswählen</label> <input id=\"book\" type=\"file\" name=\"book\" accept=\".epub\" multiple required> <button type=\"submit\" class=\"btn\">Hochladen</button></form>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
templ_7745c5c3_Err = Layout("Buch hochladen", "/").Render(templ.WithChildren(ctx, templ_7745c5c3_Var10), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = Layout("Bücher hochladen", "/").Render(templ.WithChildren(ctx, templ_7745c5c3_Var10), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user