Sometimes you need to let your users submit a file alongside other form data. Maybe it's a job application form and users need to upload their CV, or a bug reporting form and you want users to submit a screenshot. Whatever it is, StaticForms has it covered.
To enable users to upload a file, you just need to add
enctype=multipart/form-data to your form tag and add a native HTML
input element with a
type="file" to your form. Don't forget to give it a meaningful name!
<form method="POST" action="https://api.staticforms.co/<UniqueFormId>" enctype="multipart/form-data"> <label for="email">Email</label> <input type="email" name="email_address" id="email" placeholder="[email protected]" /> <label for="file_upload"></label> <input type="file" name="screenshot" id="file_upload" /> <button type="submit">Submit</button></form>
You can customise the file input control by limiting the types of files it will accept. For example, if you want it to only accept PDF files then it would look like this
<input type="file" name="attachment" accept="application/pdf" />
You can see all the forms that have been submitted on the Submissions Dashboard. When a user has uploaded a file, the submission will include links to those files which you can download to view.