BlogGuides · November 11, 2026 · 4 min read

Contact Form 7 Upload Size Limits: Test the Form, PHP and Request Body

Set an explicit Contact Form 7 file limit, budget for the complete multipart request and identify which layer rejected a staging upload.

A small PDF works in Contact Form 7, but two PDFs that each fit the field limit fail together. The form tag controls the maximum for that field, while the web server and PHP can apply a cap to the entire request. Start by finding the first layer that rejects the upload. Then decide whether to adjust the form policy, the request budget or the way you deliver accepted files.

A document card passing through three differently sized measuring frames
Generated conceptual illustration; not a product screenshot or measured result.

Write the file rule as an exact number

Decide which files the workflow actually needs. For a quote form that needs one PDF of up to 1.5 MiB, write limit:1572864 and set filetypes:pdf on the file tag. That integer means bytes. The official documentation treats limit:1mb, limit:1024kb and limit:1048576 as equivalent examples. It says a decimal expression such as limit:1.5mb is ignored. State the intended unit in your user-facing hint, especially if your support team receives screenshots from tools that display rounded file sizes.

Set file type and size explicitly for each field, then give each field a readable label. Put any size and type hint near the file input. A form with a required specification and optional supporting document needs two separate field rules. Record whether mail attachment is part of the workflow. The corresponding mail-tag belongs in the mail configuration’s attachment field when you deliberately attach the file.

Budget the whole request separately

PHP’s upload_max_filesize is a per-upload limit. Its post_max_size applies to the whole POST body. Add the maximum sizes of files that can be submitted together, then allow for other fields, multipart boundaries and headers. Two allowed 1.5 MiB files account for 3,145,728 bytes before overhead. Setting a total cap at exactly 3,145,728 bytes leaves zero space for everything else in the request. PHP also documents max_file_uploads for the number of simultaneous files.

Check the effective PHP settings for requests served by the site. A command-line PHP environment may read a different configuration from the web handler. Also ask the hosting operator about request limits at any reverse proxy, gateway or CDN. For example, Nginx documents a 413 response when the client request body exceeds the applicable client_max_body_size. The WordPress handler may never run in this case. Keep scope to the specific route or site where your hosting stack allows it, and size the budget for the files the form actually needs.

Run a staging boundary test

  1. Prepare synthetic, valid files of the permitted type. Record their exact byte lengths. A renamed arbitrary byte stream can confound the size test by failing file-type validation first.
  2. Test each field with a comfortably small file, a file one byte below the policy limit, one exactly at the limit and one one byte above. Use the same form settings and submission method that you intend to release. Record what the page actually displays.
  3. Try both files together just below their individual limits. Include typical long text field values. Record the browser Network status and response type. Repeat the smallest valid case after a failure so a separate form problem is easier to spot.
  4. Use a staging mail sink if you need to test attachments. Observe both the form outcome and the resulting message separately. Keep the fixture documents and their names synthetic, and avoid generating real lead records.

Identify which limit the evidence points to

If the request reaches WordPress and only one field gets a size error, compare that file’s length with both the form tag and PHP’s individual limit. A PHP upload error can surface inside the application’s response. If several individually valid files fail only when combined, check the total body cap first. PHP documents that exceeding post_max_size can leave both $_POST and $_FILES empty. A missing field message can therefore be a symptom of an oversized request.

A generic 413 can point to a proxy or another layer that rejects the body before form validation. Correlate its timestamp with authorized staging logs and use any available request identifier. If the form accepts the upload but a mail system rejects the resulting message, review the configured attachment policy and downstream message limit. Encoded attachments and other message parts consume room in that separate budget. Tell users what the form can accept in practice and check the full path with the CF7 file upload testing guide.

After the boundary cases pass, record the field limits and observed failure messages next to your form release checklist. For monitoring form activity after release, review the free Svetlik Analytics for Contact Form 7 plugin and keep transport-layer failures visible in the appropriate hosting logs.

In the QA record, capture the configured form limit, the actual file size, whether other files were present and the user-visible result. This lets you reproduce a report such as “a 1.5 MB PDF fails” without relying on the rounded number shown in a file picker. Repeat the boundary tests whenever the proxy or PHP runtime changes.

Sources