Skip to content

useStorageUpload

useStorageUpload(bucket): UseMutationResult<null | object, Error, object, unknown>

Hook to upload a file to a bucket

Note: You can track upload progress by passing an onUploadProgress callback in the options:

ParameterType
bucketstring

UseMutationResult<null | object, Error, object, unknown>

const upload = useStorageUpload('avatars')
upload.mutate({
path: 'user.jpg',
file: file,
options: {
onUploadProgress: (progress) => {
console.log(`${progress.percentage}% uploaded`)
}
}
})

For automatic progress state management, use useStorageUploadWithProgress instead.