Documentation, Reference Materials and Tutorials for WPForms
Do you want to allow users to upload files on your site? WPForms file upload feature allows you to easily collect files and media through your online forms. In this guide, we’ll answer all of your questions regarding the file upload feature in WPForms.
- How Can a File Upload Form Be Created?
- What File Types are Allowed for Upload?
- How Can File Extensions Be Restricted?
- What is the Maximum File Size Allowed for Uploads?
- How Do Notifications Work With File Uploads?
- Where Are Uploaded Files Stored?
How Can a File Upload Form Be Created?
WPForms makes it easy to accept files from your website visitors. All you need to do is add the File Upload field to your form with just a single click. Or you can even drag and drop the field to your desired location.
For a step-by-step guide, you can check out how to create a file upload form.
What File Types are Allowed for Upload?
Security is a huge priority for us at WPForms, so we restrict file types to safe files only. They are:
- Images like .png, .gif, .jpg
- Documents such as .doc, .xls, .ppt, .pdf
- Audio like .wav, .mp3, .mp4
- Video like .mpg, .mov, .wmv
If you want WPForms to support more file upload types, please take a look at how to allow users to upload more file types.
How Can File Extensions Be Restricted?
To restrict file extensions, click on the File Upload field in the form builder. In the Field Options panel there will a field called Allowed File Extensions. Here, you can specify the extensions you’d like to allow separated by a comma.
What is the Maximum File Size Allowed for Uploads?
To find the maximum allowed file size, you can click on the File Upload field in your drag and drop form builder. Then, from the Field Options panel, click the tooltip next to the Max File Size field. This tooltip will show the maximum file size that your server allows.
You can limit the allowed file size by specifying the size in the Max File Size field.
If you want to increase the upload size, just go to your theme’s functions.php file and copy the below code snippet.
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );
The above snippet will set the maximum file upload size to 64MB.
For more details, you can check out WPBeginner’s tutorial on increasing the maximum file upload size in WordPress.
How Do Notifications Work With File Uploads?
When a file upload form on your site is submitted, you’ll automatically be sent an email notification that contains a link to the file the user uploaded. This means you can quickly view or download the file without having to log into your WordPress dashboard.
Since file attachment can often hurt email deliverability, currently we don’t attach files on emails. For example, if an email provider only allows a maximum of 10MB attachment but the user uploads a file size higher than 10MB, the email won’t be delivered.
Where Are Uploaded Files Stored?
By default, the user-uploaded files are stored in the WPForms folder inside the Uploads directory of your site.
If you would prefer to upload the files to the media library, click on the File Upload field. Then, under Advanced Options, check the box next to Store file in WordPress Media Library.
If you enjoyed this article, you might also want to check out how to create conditional form notifications in WordPress.