• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
stevekrouse

stevekrouse

fileInputUploadExample

Public
Like
fileInputUploadExample
Home
Code
2
README.md
H
main.tsx
Branches
1
Pull requests
Remixes
1
History
Environment variables
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.
Sign up now
Code
/
Code
/
Search
main.tsx
https://stevekrouse--69897d3625f111f0ad23569c3dd06744.web.val.run
README.md

Example of an HTML Form with a File Upload, handled by the server

The key step was setting enctype="multipart/form-data" on the <form> element. If you skip that step, you'll only get the file's name on the server.

Limitation on files > 1mb

Currently (as of 4/14/24) this only works for small files (< 1mb). For larger files you get an error: {"statusCode":413,"error":"Payload Too Large","message":"request entity too large"}.

A workaround is to upload to another service client-side, send the URL from that service to your Val Town server, and then fetch the file server-side (helper: @stevekrouse/uploadTo0x0).

Migrated from folder: Archive/fileInputUploadExample

HTTP
  • main.tsx
    stevekrouse--69…44.web.val.run
Code
README.md
H
main.tsx
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.