Types

The core data shapes exchanged between your upload function and custom UI.

UploadFileItem

uplofile/types.ts
type UploadFileItem<TMeta = any, TFileSource = unknown> = {
uid: string; // generated by Uplofile, the React key
id?: string; // yours, returned from upload()
name: string;
url?: string; // set once the upload resolves
previewUrl?: string; // object URL locally, remote URL after
file?: TFileSource; // undefined for pre-hydrated files
status: UploadStatus;
progress?: number; // 0–100, only while uploading
error?: 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 server

UploadResult

uplofile/types.ts
// what your upload() must resolve with
type UploadResult<TMeta = any> = {
url: string;
id?: string;
meta?: TMeta;
previewUrl?: string;
};