fix: user photo form explicit method=post+enctype (405 when htmx missed it); admin upload action moved inline as suffix on the photo field; verified real PNG upload+serve

This commit is contained in:
2026-08-10 14:31:24 +10:00
parent 3001e816cd
commit 704cc4606f

View File

@@ -57,7 +57,7 @@
{{if .Data.PhotoUrl.Valid}}<img src="{{.Data.PhotoUrl.String}}" alt="Current photo" class="mb-2 h-32 w-32 rounded-lg object-cover">{{end}} {{if .Data.PhotoUrl.Valid}}<img src="{{.Data.PhotoUrl.String}}" alt="Current photo" class="mb-2 h-32 w-32 rounded-lg object-cover">{{end}}
</div> </div>
<div class="mt-2"> <div class="mt-2">
<form hx-encoding="multipart/form-data" hx-post="/account/tags/{{.Data.ID}}/photo" hx-target="#photo-thumb" hx-swap="innerHTML" class="flex gap-2"> <form method="post" enctype="multipart/form-data" hx-encoding="multipart/form-data" hx-post="/account/tags/{{.Data.ID}}/photo" hx-target="#photo-thumb" hx-swap="innerHTML" class="flex gap-2">
<input type="file" name="photo" accept="image/*" class="text-sm"> <input type="file" name="photo" accept="image/*" class="text-sm">
<button type="submit" class="rounded bg-stone-900 px-3 py-1.5 text-xs font-semibold text-white hover:bg-stone-700">Upload photo</button> <button type="submit" class="rounded bg-stone-900 px-3 py-1.5 text-xs font-semibold text-white hover:bg-stone-700">Upload photo</button>
<span class="htmx-indicator self-center text-xs text-stone-400">Uploading…</span> <span class="htmx-indicator self-center text-xs text-stone-400">Uploading…</span>