# createXhrUploader (@salmonui/inputs/file-upload/xhr)

> The createXhrUploader function of @salmonui/inputs/file-upload/xhr: Creates an upload transport: &lt;FileUpload upload={createXhrUploader({ url: '/api/files' })} />. Resolves with { status, body } on 2xx, rejects with an XhrUploadError otherwise and with an AbortError when canceled.

Canonical: https://salmonui.dev/docs/reference/inputs/file-upload-xhr/createXhrUploader

```ts
import { createXhrUploader } from '@salmonui/inputs/file-upload/xhr';
```

Entry index: https://salmonui.dev/docs/reference/inputs/file-upload-xhr (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/inputs/file-upload-xhr.md).

## Reference

Kind: function

```ts
function createXhrUploader(options: XhrUploaderOptions): (file: File, context: UploadContext) => Promise<XhrUploadResult>;
```

Creates an `upload` transport: `<FileUpload upload={createXhrUploader({ url:
'/api/files' })} />`. Resolves with `{ status, body }` on 2xx, rejects with
an `XhrUploadError` otherwise and with an `AbortError` when canceled.
