---
title: "useConvexUpload"
description: "Reference for the shared upload wrapper built on top of useConvexStorage."
canonical_url: "https://nuxt-convex.onmax.me/api-reference/use-convex-upload"
---
# useConvexUpload

> Reference for the shared upload wrapper built on top of useConvexStorage.

`useConvexUpload` wraps the upload flow around `useConvexStorage`.

## Import

```ts [Nuxt]
const { upload, isUploading, progress, error } = useConvexUpload()
```

```ts [Vue]
import { useConvexUpload } from 'vue-convex/storage'
```

## Signature

```ts
function useConvexUpload(options?: {
  generateUploadUrl?: () => Promise<string>
  onSuccess?: (storageId: string, file: File) => void | Promise<void>
  onError?: (error: Error) => void
  onProgress?: (progress: { loaded: number, total: number }) => void
}): {
  upload: (file: File, options?: { signal?: AbortSignal }) => Promise<string | null>
  isUploading: Readonly<Ref<boolean>>
  progress: Readonly<Ref<number>>
  error: Readonly<Ref<Error | null>>
}
```

## Behavior

- Client-only; calling `upload()` during SSR returns `null` and sets an error
- Sends the file with `XMLHttpRequest`, so `progress` (0 to 100) and `onProgress` follow the bytes sent
- Files without a type are sent as `application/octet-stream`
- Aborting through `signal` resolves `null` and sets an `AbortError`

## Related pages

- [File Storage](https://nuxt-convex.onmax.me/vue-guide/file-storage)
- [useConvexStorage](https://nuxt-convex.onmax.me/api-reference/use-convex-storage)
- [useConvexR2Upload](https://nuxt-convex.onmax.me/api-reference/use-convex-r2-upload)


## Sitemap

See the full [sitemap](https://nuxt-convex.onmax.me/sitemap.md) for all pages.
