This project is not covered by Drupal’s security advisory policy.

Adds an Attachment size total element to the webform element library. Place it anywhere on a webform to show the customer a live running total of the size of every file they have attached, and warn or block them once a size threshold is reached.

Built for Drupal 11.3, Webform 6.3, PHP 8.3. Requires Drupal 10.3+ / 11 and the Webform module.

What it does

  • Counts every File upload element on the page, including uploads nested inside composite elements and multiple-value elements (5 or 50 of them, it does not matter - a single element can hold many files and every instance is counted).
  • Counts media references as a best effort too (media library and media entity reference elements), resolving each media item back to its source file.
  • Updates the moment a file is chosen - before the AJAX upload has even finished - and again when a file is removed or a composite row is added.
  • Counts either just this page or the whole submission, per element - a multi-page (wizard) form can show a total that includes the files attached on earlier pages.
  • Is positionable: the designer drags it wherever they want on the *Build* tab, like any other element.
  • Fires thresholds at configurable sizes, each of which can show a message, add a CSS class, dispatch a JavaScript event, and optionally block submission.
  • Stores the total (in bytes) on the submission, so it shows in submission views, exports and reports.

Project information

Releases