Form With File Uploads
How to setting up a form that receives file submissions from your static site
To enable form to receive file uploads you need to :
- Add
enctype="multipart/form-data"
to your HTML form tag. - Add input field with
type="file"
attributes
Here is some code snippet:
Single file upload
<form action="https://api.formcubes.com/submission/{Your Form ID}" method="POST" enctype="multipart/form-data">
<label> Attachment : </label>
<input type="file" name="attachment"> <!-- use "file" as type and -->
<input type="submit" value="Send">
</form>
Multiple file upload
<form action="https://api.formcubes.com/submission/{Your Form ID}" method="POST" enctype="multipart/form-data">
<label> Attachment : </label>
<input type="file" name="attachment" multiple>
<input type="submit" value="Send">
</form>
Maximum submission size
Maximum size of each submission is 10MB, including text and files. So you can send anything as long as the total submission size is under 10MB.
Limitation
Our code is hosted on Google Cloud Function, one of the limitations imposed by Google Cloud Function is that the maximum request size is 10MB. If your request (submission) is larger than 10MB, your request will be rejected by Google's server and error message will be returned in plain text. So if you are using a form with a file upload feature, please validate on the client side that the total file size is below 10MB before sending it to our endpoint.