Explore Bato Web Agency Webflow Certified Partner Profile Explore Bato Web Agency Webflow Certified Partner Profile

How do you limit file size and type in Contact Form 7?

Illustration without a description Illustration without a description

Use options on the Contact Form 7 file tag to define the accepted extensions and maximum size. The filetypes option lists the formats the process needs, and limit sets the maximum bytes with a supported unit. Keep the list narrow instead of accepting every document or image format.

 

Server limits still apply. Compare the form setting with PHP’s upload_max_filesize and post_max_size, plus host, proxy, and firewall limits. Set the user-facing instruction to match the lowest real limit so visitors do not wait for an upload that the server will reject.

 

File extensions alone do not make an upload safe. Validate MIME types, prevent script execution in the storage location, and scan files where the risk warrants it. Test a valid file, an oversized file, a renamed prohibited file, and a double extension. Use protected storage when uploads contain personal or confidential information.