onUpload

Single-file callback that fires the moment a user adds a file to the Upload control queue (drag & drop or picker). Returning false from the event handler cancels the upload for that specific entry.

When it runs

  • After the client-side threshold checks (extension, blacklist, size, max files) succeed.

  • Before the binary is sent to Attachment/Upload and before the document type is set or the record is linked.

Use it to enforce additional validation (record must exists, document type semantics, advanced MIME checks) or to tweak the upload metadata (file name template, doc type override) right on the client.

Event payload (eventArgs.details)

Field
Description

fileName

Final name after applying the optional template (can still be changed in the handler).

originalFileName

Name reported by the browser/OS.

fileSize

Size in bytes.

fileType

MIME type reported by the browser.

documentTypeId / documentTypeLabel

Selected document type or null if none was chosen.

recordId / appName

Record context that the Upload control plans to use for auto-linking. Empty when the form has not been saved yet.

rawFile

Native File object reference for deep inspection.

Additional fields in Local Mode (UploadLocalMode=true)

  • rawData: full file content as text.

  • rawLines: array of lines split on \n.

  • csvLines: parsed CSV rows (semicolon/comma auto-detected).

  • fileExtension: extension without dot.

  • fileExtensionLower: lowercase extension (without dot).

Example

Tips

  • Always guard against missing record context (brixxApi.attachmentRecordId) when uploads must be linked immediately.

  • Heavy logic or server calls should remain rare; running them per file impacts perceived performance.

Last updated

Was this helpful?