In the v0.32.0 release, global events are removed and all the existing events are updated. See the migration guide.
All the File Uploader events are dispatched on the uc-upload-ctx-provider tag.
You can catch them with the native addEventListener method, or use api.on() as a programmatic alternative that returns an unsubscribe function.
Attribute ctx-name is required for the uc-upload-ctx-provider tag, see
Context for more details.
If you want to quickly inspect what happens during the upload lifecycle, add listeners for the most common events and log event.detail to the console.
Note: Use
console.logonly for debugging. In production, connect these events to your analytics or telemetry system. Avoid logging PII.
In the event types below, we mention a few external types that aren’t described on this page:
OutputFileEntry - see
OutputFileEntry for more details.OutputCollectionState - see
OutputCollectionState for more details.Type: CustomEvent<OutputFileEntry>
Dispatched when a file is added to the upload list. The OutputFileEntry
instance is in idle state. Could be suppressed if the silent option is set to
true.
Type: CustomEvent<OutputFileEntry>
Dispatched when a file is removed from the upload list. The OutputFileEntry
instance is in removed state.
Type: CustomEvent<OutputFileEntry>
Dispatched when a file upload starts. The OutputFileEntry instance is in
uploading state. Could be suppressed if the silent option is set to true.
Type: CustomEvent<OutputFileEntry>
Dispatched when a file upload progress changes. The OutputFileEntry instance
is in uploading state. Could be suppressed if the silent option is set to
true.
Type: CustomEvent<OutputFileEntry>
Dispatched when a file upload is successfully finished. The OutputFileEntry
instance is in success state. Could be suppressed if the silent option is set
to true.
Type: CustomEvent<OutputFileEntry>
Dispatched when a file upload fails. The OutputFileEntry instance is in
failed state
Type: CustomEvent<OutputFileEntry>
Dispatched when a file CDN URL is changed. This occurs when a file is uploaded and the CDN URL becomes available, or when a file is edited with the Image editor that changes the CDN URL.
Type: CustomEvent<{modalId: "start-from" | "camera" | "upload-list" | "url" | "confirmation" | "cloud-image-edit" | "external" }>
modalId – a field that lets you know which modal used.
Available in: regular and minimal modes
Dispatched when the modal is opened.
Type: CustomEvent<{modalId: "start-from" | "camera" | "upload-list" | "url" | "confirmation" | "cloud-image-edit" | "external"; hasActiveModals: boolean }>
modalId – a field that lets you know which modal used.
hasActiveModals – a field that lets you know if any modals are active at the moment.
Available in: regular and minimal modes
Dispatched when the modal is closed.
Type: CustomEvent<OutputCollectionState>
Available in: regular and inline modes
Dispatched when the Done button is clicked.
Type: CustomEvent<void>
Available in: regular and inline modes
Dispatched when the Upload button is clicked.
Type: CustomEvent<{ activity: "start-from" | "camera" | "upload-list" | "url" | "confirmation" | "cloud-image-edit" | "external" | null }>
Dispatched when the activity changes.
Type: CustomEvent<OutputCollectionState>
Dispatched when an upload process starts. The OutputCollectionState instance is
in uploading status.
It could be triggered in the following cases:
confirmUploads option is set to true and there are
ready-to-upload files in the list.Type: CustomEvent<OutputCollectionState>
Dispatched when an upload process progress changes. The OutputCollectionState
instance is in uploading status.
The progress is calculated for those files that were ready to upload at the moment when the upload process was started. That means, for example, if there were 3 uploaded files in the list, and the user added 2 more files, the progress will be calculated for those 2 new files only.
Type: CustomEvent<OutputCollectionState>
Dispatched when an upload process is successfully finished. The
OutputCollectionState instance is in success status.
The upload process is considered as successfully finished when all the files in the
list are successfully uploaded. If there are any uploading, failed or idle
files - the upload process isn’t considered as successfully finished.
Type: CustomEvent<OutputCollectionState>
Dispatched when an upload process fails. The OutputCollectionState instance is
in failed status.
The upload process is considered as failed when any of the file in the list is
in a failed status.
Type: CustomEvent<OutputCollectionState>
Dispatched when the upload list changes. Any change in the upload list itself or in the files state will trigger this event.
Type: CustomEvent<OutputCollectionState>
Dispatched when a group is created. Group will be created when the
groupOutput option is set to
true and when the upload process is considered as successfully finished.