TEMPLATE #12
Paid plans
Document Upload Form
Name, email, one or more documents and notes. File uploads need a paid plan; see the File uploads guide for large files.
HTML Tailwind React
4 fields · Multiple files
Live preview
Sandboxed<form action="https://app.submityourform.com/f" method="POST" enctype="multipart/form-data">
<!-- Your form key from the SubmitYourForm dashboard. It is public: it only lets people send to this form. -->
<input type="hidden" name="_form_key" value="YOUR-FORM-KEY" />
<!-- Honeypot: hidden from people. Submissions that fill it are filed as spam. -->
<input type="text" name="_honeypot" tabindex="-1" autocomplete="off" style="display:none" aria-hidden="true" />
<div>
<label for="f-name">Full name</label>
<input id="f-name" type="text" name="name" required />
</div>
<div>
<label for="f-email">Email</label>
<input id="f-email" type="email" name="email" required />
</div>
<div>
<label for="f-files">Documents (PDF, Word or images, max 5 MB each)</label>
<input id="f-files" type="file" name="files" accept=".pdf,.doc,.docx,.jpg,.jpeg,.png" multiple required />
</div>
<div>
<label for="f-notes">Notes</label>
<textarea id="f-notes" name="notes" rows="4"></textarea>
</div>
<button type="submit">Submit</button>
</form>
<form action="https://app.submityourform.com/f" method="POST" enctype="multipart/form-data" class="max-w-lg">
<!-- Your form key from the SubmitYourForm dashboard. It is public: it only lets people send to this form. -->
<input type="hidden" name="_form_key" value="YOUR-FORM-KEY" />
<!-- Honeypot: hidden from people. Submissions that fill it are filed as spam. -->
<input type="text" name="_honeypot" tabindex="-1" autocomplete="off" style="display:none" aria-hidden="true" />
<div class="mb-4">
<label for="f-name" class="block text-sm font-medium text-slate-700 mb-1">Full name</label>
<input id="f-name" type="text" name="name" class="w-full rounded-lg border border-slate-300 px-3 py-2 focus:border-indigo-500 focus:outline-none" required />
</div>
<div class="mb-4">
<label for="f-email" class="block text-sm font-medium text-slate-700 mb-1">Email</label>
<input id="f-email" type="email" name="email" class="w-full rounded-lg border border-slate-300 px-3 py-2 focus:border-indigo-500 focus:outline-none" required />
</div>
<div class="mb-4">
<label for="f-files" class="block text-sm font-medium text-slate-700 mb-1">Documents (PDF, Word or images, max 5 MB each)</label>
<input id="f-files" type="file" name="files" accept=".pdf,.doc,.docx,.jpg,.jpeg,.png" multiple class="w-full rounded-lg border border-slate-300 px-3 py-2 focus:border-indigo-500 focus:outline-none" required />
</div>
<div class="mb-4">
<label for="f-notes" class="block text-sm font-medium text-slate-700 mb-1">Notes</label>
<textarea id="f-notes" name="notes" rows="4" class="w-full rounded-lg border border-slate-300 px-3 py-2 focus:border-indigo-500 focus:outline-none"></textarea>
</div>
<button type="submit" class="w-full rounded-lg bg-indigo-600 px-4 py-2 font-medium text-white hover:bg-indigo-700">Submit</button>
</form>
"use client"; // Next.js App Router: this form runs in the browser. Remove the line in other React apps.
import { useState } from "react";
export default function DocumentUploadForm() {
const [status, setStatus] = useState("idle");
const [error, setError] = useState("");
async function onSubmit(event) {
event.preventDefault();
const form = event.currentTarget;
setStatus("sending");
setError("");
const data = new FormData(form);
data.append("_form_key", "YOUR-FORM-KEY");
try {
const res = await fetch("https://app.submityourform.com/f", { method: "POST", body: data, headers: { Accept: "application/json" } });
const json = await res.json().catch(() => ({}));
if (res.ok && json.ok !== false) {
setStatus("sent");
form.reset();
} else {
const fields = (json.error?.fields ?? []).map((f) => f.message).join(" ");
setError([json.error?.message || "Something went wrong. Please try again.", fields].filter(Boolean).join(" "));
setStatus("error");
}
} catch {
setError("Couldn't reach the server. Check your connection and try again.");
setStatus("error");
}
}
return (
<form onSubmit={onSubmit}>
<input type="text" name="_honeypot" tabIndex={-1} autoComplete="off" style={{ display: "none" }} aria-hidden="true" />
<label>Full name<input type="text" name="name" required /></label>
<label>Email<input type="email" name="email" required /></label>
<label>Documents (PDF, Word or images, max 5 MB each)<input type="file" name="files" accept=".pdf,.doc,.docx,.jpg,.jpeg,.png" multiple required /></label>
<label>Notes<textarea name="notes" rows={4} /></label>
<button type="submit" disabled={status === "sending"}>Submit</button>
{status === "sent" && <p role="status">Thanks, we received your submission.</p>}
{status === "error" && <p role="alert">{error}</p>}
</form>
);
}
Replace YOUR-FORM-KEY with the form key from your form's Setup page (in the app, forms are called Endpoints). The form key is public; never put your REST API key (syf_live_…) in browser code. This template sends files with the form itself, up to your form’s file size limit (max 5 MB per file). For files up to 25 MB, use the upload API in File uploads. On the Free plan, remove the file input: forms that send files are refused there.