Fields

File Upload

File Upload is the field for selecting, restoring, and listing uploaded files.

Use this page to preserve the input attributes, hidden upload inputs, and summary or upload-manager containers used by the field.

Preview

File Input (Simple)

Upload Manager (Advanced)

Display types

File Upload can render as:

  • fileInput — native <input type="file"> with an uploaded-file summary (File Input (Simple))
  • uploadManager — drag-and-drop upload zone with async staged uploads (Upload Manager (Advanced))

Both display types share the same hidden asset ID contract and submit Craft asset references.

Attributes

File Upload fields span a field wrapper, one or more controls, and supporting hidden inputs.

Field

AttributeDescriptionImportance
data-formie-field-handleStable field identity used by validation, conditions, and error renderingRequired

File Input (Simple)

AttributeDescriptionImportance
name="fields[attachments][]"File input payload name for selected filesRequired
data-formie-inputGeneric Formie input marker included in normal outputRecommended
data-formie-file-inputFile upload selector used by the file-upload moduleRequired for Simple upload behaviour
data-formie-input-idStable identifier used to match upload resultsRequired for upload behaviour
data-formie-input-type="file"Server-rendered file-input type markerRecommended
data-formie-file-upload-keyExplicit event-matching key for upload responsesOptional
data-formie-file-limitFile-count validation limitOptional
data-formie-size-min-limitMinimum file size validation in MBOptional
data-formie-size-max-limitMaximum file size validation in MBOptional
data-formie-file-upload-hydrate-endpointOverride for uploaded asset hydrationOptional

Upload Manager (Advanced)

AttributeDescriptionImportance
data-formie-upload-manager-rootRoot container for the upload manager UIRequired for Advanced upload behaviour
data-formie-upload-managerDropzone selector used by the upload-manager moduleRequired for Advanced upload behaviour
data-formie-upload-manager-browseBrowse button inside the dropzoneRequired
data-formie-upload-manager-inputHidden file input used for browse selectionRequired
data-formie-validation-skipOpts the browse input out of client-side validation; required state is owned by the status inputRequired
data-formie-upload-manager-statusScreen-reader-only validation status inputRequired for required validation
data-formie-upload-manager-listUploaded file list containerRequired
data-formie-input-type="upload-manager"Server-rendered display-type marker on the dropzoneRecommended
data-formie-upload-keyStable upload identity for the fieldRecommended
data-formie-file-upload-upload-endpointOverride for async upload actionOptional
data-formie-file-upload-delete-endpointOverride for staged file deletionOptional
data-formie-file-upload-hydrate-endpointOverride for uploaded asset hydrationOptional
data-formie-file-limitFile-count validation limitOptional
data-formie-size-min-limitMinimum file size validation in MBOptional
data-formie-size-max-limitMaximum file size validation in MBOptional

Upload manager list items are created at runtime and include:

AttributeDescription
data-formie-upload-manager-itemUploaded file row
data-formie-upload-manager-filenameFilename label
data-formie-upload-manager-progressProgress container
data-formie-upload-manager-progress-trackProgress track
data-formie-upload-manager-progress-barProgress bar
data-formie-upload-manager-progress-labelProgress status label
data-formie-upload-manager-sort-controlsSort control wrapper
data-formie-upload-manager-sort="up" / "down"Reorder buttons
data-formie-upload-manager-removeRemove button
data-formie-upload-manager-errorUpload error message

Supporting elements

Both display types depend on hidden asset inputs:

AttributePurposeImportance
data-formie-file-upload-anchor="true"Stable insertion point for uploaded asset IDsRequired when uploads are synchronized back into hidden inputs
data-formie-file-upload-asset-id="true"Stored uploaded asset IDs for restored stateManaged by Formie

Field summary (Simple only)

AttributePurposeImportance
[data-formie-file-summary]Summary wrapper for uploaded filenamesRecommended
[data-formie-file-summary-container]Summary list containerRecommended
[data-formie-file-summary-item]Individual uploaded file labelRecommended

If a summary container is missing on Simple fields, Formie can create one after the file input. Hand-authored templates should still keep it explicit when possible so the server-rendered and browser-updated states match.

Behavior

File Input (Simple)

The file-upload module:

  • validates file count and size limits from data-formie-file-limit, data-formie-size-min-limit, and data-formie-size-max-limit
  • listens for upload result payloads and synchronizes uploaded asset IDs into hidden inputs beside the file input
  • hydrates filename labels for stored asset IDs when only numeric asset references are initially available
  • resets both summary output and hidden asset inputs when the form emits formie:state:reset

Upload Manager (Advanced)

The upload-manager module:

  • uploads files immediately through Formie’s upload endpoint and writes asset IDs into hidden inputs
  • hydrates existing asset IDs from hidden inputs on init
  • removes staged files through the delete endpoint
  • reorders uploaded files with up/down controls and keeps hidden inputs in sync
  • validates required state and file-count limits through the shared validator
  • re-initializes when Repeater rows are added

See the upload-manager module page for endpoint and event details.

Events

File Upload emits field events when uploaded asset ids have been synchronized back into the field state.

The formie:field:file-upload:uploaded-assets-sync event

Triggered after uploaded asset ids have been hydrated into the field state. Both display types emit this event.

js
document.addEventListener('formie:field:file-upload:uploaded-assets-sync', (event) => {
  const { fileUpload, assets } = event.detail;

  // Only target the attachments field.
  if (fileUpload?.dataset.formieFieldHandle !== 'attachments') {
    return;
  }

  // Reflect the current uploaded file count on the field wrapper.
  fileUpload.dataset.uploadedCount = String(assets.length);
});

The formie:field:file-upload:uploaded-assets-reordered event

Triggered after the user reorders uploaded files in Upload Manager (Advanced) fields.

js
document.addEventListener('formie:field:file-upload:uploaded-assets-reordered', (event) => {
  const { fileUpload, assets } = event.detail;

  console.log('Reordered assets', fileUpload?.dataset.formieFieldHandle, assets);
});

Styling classes

These classes are for presentation only. They are not behavior requirements:

File Input (Simple)

ClassDescription
formie-inputShared file-input styling and focus treatment
formie-file-inputFile Upload input styling class
formie-input-errorError-state styling class
formie-field-noteSummary note wrapper styling
formie-file-summarySummary wrapper for uploaded files
formie-file-summary-containerSummary list container
formie-file-summary-itemIndividual uploaded file label

Upload Manager (Advanced)

ClassDescription
formie-upload-managerUpload manager root styling
formie-upload-manager-dropzoneDropzone surface
formie-upload-manager-browse-buttonBrowse button styling
formie-upload-manager-listUploaded file list
formie-upload-manager-itemUploaded file row
formie-upload-manager-filenameFilename label
formie-upload-manager-progressProgress container
formie-upload-manager-progress-trackProgress track
formie-upload-manager-progress-barProgress bar
formie-upload-manager-progress-labelProgress status label
formie-upload-manager-sort-controlsSort control wrapper
formie-upload-manager-sort-buttonReorder button styling
formie-upload-manager-actionsAction button wrapper
formie-upload-manager-remove-buttonRemove button styling
formie-upload-manager-errorUpload error message

Accessibility notes

  • Keep the file input or browse button explicitly labeled with the field label.
  • Uploaded state should remain close to the control so users can review staged files.
  • Error state should still apply through the surrounding field layout, not just the native file input or dropzone.
Last updated: Aug 18, 2026, 4:01 PM