/Knowledge/sources/honojs__hono/llms-full/body-limit-middleware-usage--66792265e934.md
Body Limit Middleware: Usage - hono-docs
Body Limit Middleware: Usage Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt usage Summary ts const ap...
Body Limit Middleware: Usage
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#usage
Summary
## Content
```ts
const app = new Hono()
app.post(
'/upload',
bodyLimit({
maxSize: 50 * 1024, // 50kb
onError: (c) => {
return c.text('overflow :(', 413)
},
}),
async (c) => {
const body = await c.req.parseBody()
if (body['file'] instanceof File) {
console.log(`Got file sized: ${body['file'].size}`)
}
return c.text('pass :)')
}
)
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#usage",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Body Limit Middleware > Usage",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 263,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Body Limit Middleware: Usage",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}