Skip to main content

File uploads (withFiles + Sharp + R2)

Generated from pattern-library/registry.json — do not edit by hand; change the registry and run bun run patterns:build.

Index card — the docs below are the canonical explanation; deep-tier pattern pages additionally carry invariants and emulation notes.

Category: Forms & Validation · Tier: light · Maturity: proven (verified 2026-08-20 @ 1a130d67) · Risk: medium — server-side file handling (sharp, r2 storage)

Server-side file upload handling that processes images with Sharp and persists them to Cloudflare R2, validating file metadata via Valibot rather than the file bytes themselves in-schema.

When to use: Use when a form needs to accept file uploads (e.g. images) that are processed and stored server-side.

Docs

Code

Tests

  • src/lib/server/store/blog/upload-ticket.test.ts (GitHub · GitLab)

Proof


Machine-readable record: forms-file-uploads in pattern-library/registry.json.

← Back to Pattern Library

Think this pattern could be better? Tell us how.

Leave feedback