Skip to content

useStorageUploadWithProgress

useStorageUploadWithProgress(bucket): object

Hook to upload a file to a bucket with built-in progress tracking

ParameterType
bucketstring

object

NameTypeDefault value
progressUploadProgress | null-
reset()() => void-
uploadUseMutationResult<{ fullPath: string; id: string; path: string; } | null, Error, { file: Blob | File | ArrayBuffer; options?: Omit<UploadOptions, "onUploadProgress">; path: string; }, unknown>mutation
const { upload, progress, reset } = useStorageUploadWithProgress('avatars')
// Upload with automatic progress tracking
upload.mutate({
path: 'user.jpg',
file: file
})
// Display progress
console.log(progress) // { loaded: 1024, total: 2048, percentage: 50 }