Skip to main content

Upload Callbacks (onUploadSuccess / onUploadError)

Concept

DescriptiononUploadSuccess and onUploadError let you react to file upload outcomes. Use them to send analytics events when a file upload succeeds or fails.

onUploadSuccess

Type() => void
DescriptionFires when file upload and parsing succeed and the content policy passes, once per successful upload attempt. Also fires if stepHandler.uploadStep blocks navigation. Does not fire when the user clicks "Manual Entry".

onUploadError

Type({ type: string, message: string }) => void
DescriptionFires when a file upload fails and the user sees an error modal. The message field contains the same localized string shown in the error modal body. Does not fire when a parse is cancelled or when stepHandler.uploadStep throws an error.

Error types

typeScenario
file-invalid-typeFile format is not in inputTypes
file-too-largeFile exceeds the maximum size
too-many-filesMultiple files uploaded when multipleFileUpload is false
parse-errorFile could not be parsed due to invalid formatting
advanced-parsing-not-allowedFile requires advanced parsing that is not included in the subscription
empty-fileFile is empty after parsing
max-records-exceededRow count exceeds maxEntries
unknownAny other parse error

Basic syntax

<DataImporter
licenseKey="Your License Key"
settings={{
developerMode: true,
identifier: "product_data",
columns: [],
}}
onUploadSuccess={() => analytics.track("file-upload-success")}
onUploadError={({ type, message }) => analytics.track("file-upload-error", { type, message })}
/>