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:
2026-08-15 14:23:05 +02:00
co-authored by Copilot
parent a51578cbf1
commit be3dfaeb47
3 changed files with 52 additions and 22 deletions
+4 -4
View File
@@ -69,16 +69,16 @@ templ LoginPage(errMsg string) {
}
templ UploadPage(errMsg string) {
@Layout("Buch hochladen", "/") {
@Layout("Bücher hochladen", "/") {
<section class="page-head">
<h2>Buch hochladen</h2>
<h2>Bücher hochladen</h2>
</section>
if errMsg != "" {
<p class="error">{ errMsg }</p>
}
<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 />
<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>
}