Advanced File Uploader
For large attachments or multiple file uploads, use our advanced file uploader.
Heads Up! This is a PRO feature. You must have an active membership to use this feature.
Our Default HTML5 File Uploader only supports file attachments up to 5 MB. Also currently it does not support multiple files. If you need to upload large files or multiple files, use our advanced file uploader.
Step 1: Add a hidden <input> inside your form with `data-fileupload` attribute
Step 2: Add the following script before the closing of </body>
Live Demo on Codepen
Full Code
If you add just two lines to your contact form, you will get an advanced file upload form.
Note: You do not need to use multipart/form-data
if you are using our advanced file uploader. You can just use the normal method.
File Upload Options
You may also pass many options to the file upload using data-* attributes. Here are some of the following:
Data Attribute | Default Value | Description |
---|---|---|
|
| Set to |
|
| Maximum File Size in MB. eg: |
|
| Set to |
|
| File Upload Button Text |
|
| File Upload button background color. Values in Hex |
|
| File Upload button text color. Values in Hex |
Our File Upload API is powered by UploadCare. So you can also add any data-*
attributes supported by them. See more available options here
Client Side Validation
Use this snippet to make file upload a required filed and to validate if the file is uploaded or not.
Add the following code block just above the closing of </body> and make sure YOUR_FORM_ID
is updated with your form id.
React & React Hook Form
If you are using React with React Hook form, The attachment field might not send properly. To set up, use the following method.
You can use the Web3Forms Public Key (as shown below) or create your own from UploadCare if you want to store data.
Last updated