Limit File Upload Size For Caldera Forms File Fields

Landscape photo of a volcano in the ocean with some greenery in the forefront

 

The Caldera Forms file field settings being edited for a form.With Caldera Forms basic file fields and advanced file fields, you can set a maximum file size for any file uploaded through these fields. This feature, which was added in Caldera Forms 1.8.0, allows you to set the maximum size in bytes for each file.

In the Maximum Upload Size setting you can enter the size of the file in bytes. For example, to limit to 128kb, enter 128000.

  • 128KB is 18000 bytes
  • 512kb is 512000 bytes
  • 1MB is 1024000 bytes

Limiting Caldera Forms Max Upload Size With A Filter

Note: Before version 1.8.0 of Caldera Forms, this filter was the only method for limiting file size.

The maximum allowed size for uploads from Caldera Forms  is also limited by  WordPress’ upload_size_limit filter. If you set a value larger then WordPress’ limit in the field settings, WordPress’ limit will still apply.

Where Does This Code Go?

When using WordPress hooks to customize Caldera Forms or other plugins you should not modify the plugin files, or you will lose your changes when you update the plugin. Instead you should create a small plugin to hold the custom code. It's easy, learn how here.

Technically you can add the custom code to your theme's functions.php, but then you will not be able to change your theme and keep these customizations.

Learn More