hono-form-upload
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
main.tsx
https://stevekrouse--53eaf748431511f085ae76b3cceeab13.web.val.run
A minimal server-rendered file upload example using Hono and Hono JSX.
- Simple file upload form with HTML5 file input
- Server-side rendering with Hono JSX
- File processing and content display
- Error handling for upload failures
- Responsive styling
- GET /: Displays the upload form
- POST /upload: Processes the uploaded file and shows results
The server:
- Accepts any file type via multipart/form-data
- Reads the file content as text
- Displays file metadata (name, size, type)
- Shows the file content (works best with text files)
- Visit the root URL to see the upload form
- Select a file using the file input
- Click "Upload File" to submit
- View the file information and content on the results page
- Built with Hono 4.0.0 and Hono JSX
- Uses
c.req.parseBody()to handle multipart form data - Inline CSS for styling
- Error handling for missing files and processing errors
