View as Markdown

API reference: @salmonui/inputs/file-upload/xhr

createXhrUploaderfunction

import { createXhrUploader } from '@salmonui/inputs/file-upload/xhr';
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.