Multipart upload

A "use server" action receives a Web Request with the multipart body; req.formData() parses it. Small bodies stay in-memory; bodies above the spool threshold (~1 MB) hit the streaming parser via the __bextReadChunk bridge native.

Upload a file

Source

// src/actions/upload.ts
    "use server";

export async function handleUpload(req: Request): Promise<Response> {
            const form = await req.formData();
            const file = form.get("file");
            // file.name, file.size, file.type
            return new Response(null, { status: 303, headers: { Location: "/examples/upload?ok=1" } });
}
// page.tsx
<form method="post" action="/_bext/action/handleUpload" enctype="multipart/form-data">
                <input type="file" name="file" />
                <input name="note" placeholder="optional note" />
                <button>upload</button>
</form>