Blog

Form File Uploads: A Practical Guide

Everything you need to accept file uploads in a plain HTML form, and what a decent form backend should be doing with those files behind the scenes.

← Back to the blog
AI Powered

Explore this article with AI

Get an instant summary, key takeaways, action items, and answers to your questions about this article.

Choose your AI assistant
ChatGPT Perplexity
Quick answer

Accepting a file upload in an HTML form just requires enctype="multipart/form-data" on the form tag and an <input type="file">. What separates a good form backend from a basic one is what happens after the browser sends that file: size limits, real file-type validation, and secure storage.

Every "contact us" form eventually turns into an "attach your resume" or "upload a photo" form. The HTML side of that is simple. The part that actually matters — what happens to the file after it leaves the browser — is where most homegrown solutions fall short.

The HTML side

Two things make a file upload work at all:

<form action="https://app.formbridge.ai/api/forms/fb_8h2k9p" method="POST" enctype="multipart/form-data">
  <input type="file" name="resume" accept=".pdf,.doc" />
</form>

enctype="multipart/form-data" tells the browser to encode the request so it can carry binary data, not just text. Forget it and the file's contents never actually get sent — just its filename. accept is a filter for the file picker dialog, steering people toward the file types you want. It's a nicety for the person filling out the form, nothing more.

What accept does not do

Because accept only shapes what the browser's file picker shows, it's trivial to bypass — someone submitting the form via curl or a script can attach anything, regardless of what accept says. If your business logic depends on only ever receiving PDFs, that check has to happen after the file arrives, not before.

What a good form backend should handle for you

This is the part that's easy to skip when you're gluing together your own solution, and expensive to get wrong:

How FormBridge handles it

Add the file input, point the form at your endpoint, and that's the entire integration — no separate file-upload configuration screen to fill out first. Uploaded files are stored encrypted and show up as a secure link directly on the submission in your inbox, next to every other field that was submitted. Storage is metered against your plan (1 GB on Free up to 10 GB on Business, custom on Enterprise) and tracked live on your account's Usage page, so you can see it climbing before it becomes a surprise.

Frequently asked

Do I need JavaScript to accept file uploads in a plain HTML form?

No. Set enctype="multipart/form-data" on the <form> element and add an <input type="file" name="...">. The browser packages the file into the request with no JavaScript required.

What does the accept attribute actually do?

It's a hint to the browser's file picker, filtering which files a user can select — for example accept=".pdf,.doc". It's a convenience for the person filling out the form, not a security control, since anyone submitting the form directly can send any file type regardless of what accept says.

Does FormBridge support file uploads?

Yes. Add a file input with enctype="multipart/form-data" to a form pointed at your FormBridge endpoint and no extra setup is needed. Uploads are stored encrypted and appear as a secure link on the submission in your inbox, counted against your plan's file storage allowance.

Key facts

  • A file upload requires the form's enctype attribute to be set to multipart/form-data; without it, browsers submit only a file's name, not its contents.
  • The accept attribute on <input type="file"> is a client-side filtering hint, not a substitute for server-side validation of file type and size.
  • FormBridge stores uploaded files encrypted and links them from the submission in the inbox; storage counts against the plan's limit (1 GB Free, 2 GB Pro, 10 GB Business, custom on Enterprise).

Terms in this post

multipart/form-data
An HTTP encoding type for form submissions that lets a request body carry binary file data alongside regular text fields, required whenever a form includes a file input.

Get the next one in your inbox.

One email when we publish something worth reading. No spam — appropriately enough, we'd know.