Skip to main content

FileUpload

shadow

The FileUpload component provides a universal file upload function for web applications. It supports customizable attributes such as allowed file types, part size or also maximum file size, along with drag-and-drop methods and traditional file selection.

Basic usage

With the icon

When to use

Use wje-file-upload when users need to enter values, choose options, or trigger form-related actions.

When not to use

Do not use it as a decorative element without interaction. Prefer presentational components in that case.

Accessibility

Always provide a label (label/aria-label), keep keyboard support, and surface clear validation feedback.

Best Practices

  • Keep validation rules and error behavior consistent across the entire form.
  • Show loading or disabled states during async operations.
  • Split complex forms into smaller sections with immediate feedback.

Attributes and Properties

label

DescriptionSets the user-visible or accessible label text.
Attributelabel
Typestring
Default-

acceptedTypes

DescriptionThe accepted file types for upload.
Attributeaccepted-types
Typestring
Default-

chunkSize

DescriptionThe chunk size for file upload.
Attributechunk-size
Typenumber
Default-

maxFileSize

DescriptionThe maximum file size for upload.
Attributemax-file-size
Typenumber
Default-

uploadUrl

DescriptionThe URL to set as the upload URL.
Attributeupload-url
Typestring
Default-

autoProcessFiles

DescriptionThe auto process files attribute.
Attributeauto-process-files
Typeboolean
Default-

noUploadButton

DescriptionThe no upload button attribute.
Attributeno-upload-button
Typeboolean
Default-

Events

NameDescription
wje-file-upload:file-removedEmitted when the wje-file-upload:file-removed event is dispatched.
wje-file-upload:files-selectedEmitted when the selection changes.
wje-file-upload:errorEmitted when the component encounters an error state.
wje-file-upload:files-addedEmitted when the wje-file-upload:files-added event is dispatched.
wje-file-upload:files-uploadedEmitted when the wje-file-upload:files-uploaded event is dispatched.
wje-file-upload:startedEmitted when the wje-file-upload:started event is dispatched.
wje-file-upload:file-uploadedEmitted when the wje-file-upload:file-uploaded event is dispatched.

Methods

addFilesToQueue

DescriptionMethod to add files to the queue.
Signature(files: any) => void

uploadFiles

DescriptionMethod to upload files.
Signature() => void

createPreview

DescriptionMethod to create a preview for the file.
Signature(file: File, reader: FileReader) => HTMLElement

createThumbnail

DescriptionMethod to create a thumbnail for the file.
Signature(file: File, reader: FileReader) => HTMLElement

assertFilesValid

DescriptionMethod to validate the files.
Signature(file: File) => void

resetFormState

DescriptionMethod to reset the form state.
Signature() => void

CSS Shadow Parts

NameDescription
nativeThe native file upload part.
file-listThe file list part.
upload-buttonThe label part.

CSS Custom Properties

No CSS custom properties available for this component.

Slots

NameDescription
defaultThis is a default/unnamed slot.