Validate at two boundaries
The client should explain errors quickly, but the backend must enforce the actual limits. Validate length, format, allowed values and file size or type before accepting a submission.
File upload checklist
The list below breaks this down into the parts that matter most. Read through each one and note anything that applies to your own setup.
- Limit file size and accepted MIME types.
- Generate a safe object path instead of trusting a filename.
- Keep private uploads in a protected bucket.
- Save the upload reference with the related form record.
- Delete abandoned or replaced files deliberately.
Email delivery
Follow the sequence below from start to finish. The order matters: later steps assume the earlier ones are done.
- Persist the form record before attempting notification delivery.
- Send only the fields the recipient needs.
- Use a verified sending domain and a clear From identity.
- Record delivery status without exposing provider secrets.
- Provide a retry or queue path for temporary failures.
Privacy
Only collect files and personal information that the stated purpose requires. Tell visitors how the submission is used and provide a route to request help with their data.
Examples of validation worth enforcing
Before making changes, work through the points below. Each one covers a different part of the picture, so treat them as a set rather than picking favourites.
- Reject files above the agreed size limit with a message stating the actual limit, not a generic error.
- Reject file types outside an explicit allow list rather than blocking a deny list, since deny lists miss variants.
- Cap free-text fields at a sensible length so a single submission cannot exhaust storage or notification quotas.
- Require a valid format for email and phone fields before accepting the submission.
- Strip or reject unexpected fields in the payload rather than silently storing them.
Handover checklist for a launched form
A few moving parts are involved here. The points below cover each of them, so you can see the full scope before deciding where to start.
- Document which fields are required, their limits and where the data lands.
- Confirm who receives the email notification and what to do if it stops arriving.
- Confirm storage bucket permissions match the sensitivity of the uploaded files.
- Note the retry or manual resend path for a failed notification.
- Set a reminder to review and delete stale uploaded files on a schedule.