Types
The core data shapes exchanged between your upload function and custom UI.
UploadFileItem
type UploadFileItem<TMeta = any, TFileSource = unknown> = {uid: string; // generated by Uplofile, the React keyid?: string; // yours, returned from upload()name: string;url?: string; // set once the upload resolvespreviewUrl?: string; // object URL locally, remote URL afterfile?: TFileSource; // undefined for pre-hydrated filesstatus: UploadStatus;progress?: number; // 0–100, only while uploadingerror?: string; // set on a failed upload or a failed onRemove (status stays "done")meta?: TMeta; // anything you attach in beforeUpload};
UploadStatus
The item’s whole lifecycle. Branch on this in a custom preview.
"idle"Selected and waiting for upload to start"uploading"In flight. progress is populated if you call setProgress"done"url is now set; may carry a leftover error if a removal attempt failed"error"upload() rejected, or beforeUpload returned an invalid result with a reason"canceled"Aborted via the signal; it no longer counts toward maxCount"removing"Only under removeMode="strict", waiting on the serverUploadResult
// what your upload() must resolve withtype UploadResult<TMeta = any> = {url: string;id?: string;meta?: TMeta;previewUrl?: string;};