Skip to content

useStorageUploadWithProgress

useStorageUploadWithProgress(bucket): object

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

Parameter Type
bucket string

object

Name Type Default value
progress UploadProgress | null -
reset() () => void -
upload UseMutationResult<{ 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 }