Simple: multipart forms
Add enctype="multipart/form-data" and file inputs. Files are stored with the submission and linked from the email. Each file can be up to the size set in your form's Settings → Spam & security (1 to 5 MB); use the upload API below for bigger files.
<form action="https://app.submityourform.com/f" method="POST" enctype="multipart/form-data">
<input type="hidden" name="_form_key" value="YOUR-FORM-KEY">
<input type="file" name="resume">
<button>Send</button>
</form>
Large files: upload first, then submit
For files up to 25 MB:
- Ask for an upload link:
GET https://app.submityourform.com/upload?file=report.pdf&size=BYTES&type=MIME&form_id=YOUR-FORM-KEY.form_idis the same value as your form key;sizeandtypelet us refuse a file that's too big, of a blocked type or over your storage quota before you send it. It works from the browser and returns{ "url": "…", "key": "uploads/…" }. The link expires after a short time and can be used once. PUTthe file's bytes tourl. The link points to SubmitYourForm, which stores the file; no extra headers are needed.- Submit the form with a field
_filesset to the returnedkey(several keys separated by commas).
async function uploadFile(file) {
const q = new URLSearchParams({ file: file.name, size: file.size, type: file.type, form_id: 'YOUR-FORM-KEY' });
const r = await fetch(`https://app.submityourform.com/upload?${q}`);
if (!r.ok) throw new Error((await r.json()).message); // e.g. FILE_TYPE_NOT_ALLOWED, STORAGE_QUOTA_EXCEEDED
const { url, key } = await r.json();
const put = await fetch(url, { method: 'PUT', body: file });
if (!put.ok) throw new Error('Upload failed');
return key;
}
form.addEventListener('submit', async (e) => {
e.preventDefault();
const data = new FormData(form);
const file = data.get('resume'); data.delete('resume'); // don't send the file twice
if (file && file.size) data.append('_files', await uploadFile(file));
await fetch('https://app.submityourform.com/f', { method: 'POST', headers: { Accept: 'application/json' }, body: data });
});
Errors from /upload use the usual shape, { "ok": false, "message": "…", "error": { "code": "…", "message": "…" } }: PLAN_FEATURE_REQUIRED (Free plan), FILE_TYPE_NOT_ALLOWED, FILE_TOO_LARGE, STORAGE_QUOTA_EXCEEDED, FORM_DISABLED and RATE_LIMITED (upload links are limited per visitor per form per hour).
Limits and safety
- Allowed file types and the per-file size limit are set in your form's Settings → Spam & security. Executables, scripts, HTML and SVG files are always blocked.
- Uploaded files count towards your workspace storage (5 GB on Growth, 10 GB on Agency; more with the storage add-on). Files sent with
_filescount when the submission arrives. - Webhooks and the notification email include signed links to the files, not the files themselves.
- Download links are signed and expire.
- Automatic malware scanning of uploads is not enabled yet. Treat uploaded files like any file from the internet before opening them.