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

This example presents the baseline file upload flow without extra customizations. It is the best starting point for understanding structure and behavior.

With the icon

This example replaces image preview with an icon, which is useful for file types that do not have a meaningful visual preview.

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

acceptedTypes

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

autoProcessFiles

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

chunkSize

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

label

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

maxFileSize

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

maxFiles

DescriptionSets the maximum number of files that can be uploaded or managed. Assigns the specified value to the 'max-files' attribute.
Attributemax-files
Typenumber
Default10

noUploadButton

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

toChunk

DescriptionSets the to-chunk attribute.
Attributeto-chunk
Typeboolean
Defaultfalse

uploadUrl

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

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.