diff --git a/src/anthias_server/app/static/src/home.ts b/src/anthias_server/app/static/src/home.ts index 316d263d..77daff8c 100644 --- a/src/anthias_server/app/static/src/home.ts +++ b/src/anthias_server/app/static/src/home.ts @@ -223,13 +223,14 @@ function homeApp(): HomeAppData { }, // Multi-file upload (issue #3045). The server's assets_upload - // endpoint takes exactly one file per POST, so a multi-select - // batch is uploaded sequentially — one XHR per file — rather - // than via htmx's single-form submit. Driving it from JS (instead - // of hx-post on the
) is what makes "X of N" progress and - // per-file failure handling possible; htmx would only ever see - // the first file in the input. Mirrors the pre-#2818 React - // behaviour added in #2778. + // endpoint reads exactly one file per request + // (request.FILES.get('file_upload')), so a single htmx form POST — + // which would carry every selected file in the multipart body — + // would still only create one asset. uploadFiles() instead uploads + // the batch sequentially, one XHR (one file) per request. Driving + // it from JS (instead of hx-post on the ) is also what makes + // "X of N" progress and per-file failure handling possible. Mirrors + // the pre-#2818 React behaviour added in #2778. async uploadFiles(input: HTMLInputElement) { const files = input.files ? Array.from(input.files) : [] const form = input.form diff --git a/src/anthias_server/app/templates/_asset_modal.html b/src/anthias_server/app/templates/_asset_modal.html index 0d481d2d..91f50780 100644 --- a/src/anthias_server/app/templates/_asset_modal.html +++ b/src/anthias_server/app/templates/_asset_modal.html @@ -66,12 +66,14 @@
- {% comment %} The file tab is NOT htmx-managed. assets_upload takes - one file per POST, so a multi-select batch is uploaded - sequentially by uploadFiles() in home.ts (one XHR per file) — - htmx's single-form submit would only ever send the first file. - The action / enctype attributes stay so uploadFiles() can read - the endpoint URL off the form and the CSRF token off its input. + {% comment %} The file tab is NOT htmx-managed. assets_upload reads + one file per request (request.FILES.get('file_upload')), so a + single htmx form POST — even though it would carry every + selected file in the multipart body — would only ever get one + asset created. uploadFiles() in home.ts instead uploads the + batch sequentially, one XHR (one file) per request. The action + / enctype attributes stay so uploadFiles() can read the endpoint + URL off the form and the CSRF token off its input. {% endcomment %}