Multi-upload to image library #56 (#60)

* feat: support for file upload handler to track multiple files

* feat: update image upload endpoint to allow multiple files

* fix: lint
This commit is contained in:
DecDuck
2025-06-01 16:06:56 +10:00
committed by GitHub
parent 3e5c3678d5
commit 40e66def1e
6 changed files with 42 additions and 22 deletions

View File

@ -14,14 +14,16 @@ export default defineEventHandler(async (h3) => {
statusMessage: "This endpoint requires multipart form data.",
});
const uploadResult = await handleFileUpload(h3, {}, ["internal:read"]);
const uploadResult = await handleFileUpload(h3, {}, ["internal:read"], 1);
if (!uploadResult)
throw createError({
statusCode: 400,
statusMessage: "Failed to upload file",
});
const [id, options, pull, dump] = uploadResult;
const [ids, options, pull, dump] = uploadResult;
const id = ids.at(0);
// handleFileUpload reads the rest of the options for us.
const name = options.name;