Uplofile is open sourceStar on GitHub

Props Reference

Complete reference for the core data types.

type UploadFileItem Type

PropertyTypeDescription
uidstringUnique identifier generated by Uplofile
idstring?Optional ID from your backend
namestringFile name
statusUploadStatusCurrent status: "idle", "uploading", "done", "error", "canceled", "removing"
progressnumber?Upload progress (0-100)
previewUrlstring?URL for image preview (object URL or remote URL)
urlstring?Remote URL of the uploaded file
errorstring?Error message if upload fails
fileFile?The original File object (undefined for pre-hydrated files)

Usage Example

1import { type UploadFileItem } from "uplofile";
2
3function FileInfo({ item }: { item: UploadFileItem }) {
4 return (
5 <div>
6 <h3>{item.name}</h3>
7 <p>Status: {item.status}</p>
8 {item.status === "uploading" && <p>Progress: {item.progress}%</p>}
9 {item.status === "error" && <p className="error">Error: {item.error}</p>}
10 {item.previewUrl && <img src={item.previewUrl} alt="Preview" />}
11 </div>
12 );
13}