API reference: @salmonui/inputs/file-upload/xhr
XhrUploaderOptionsinterface
import type { XhrUploaderOptions } from '@salmonui/inputs/file-upload/xhr';interface XhrUploaderOptions {
readonly url: string | ((file: File) => string);
readonly method?: string | undefined;
readonly headers?: Readonly<Record<string, string>> | ((file: File) => Readonly<Record<string, string>>) | undefined;
readonly fieldName?: string | undefined;
readonly data?: Readonly<Record<string, string>> | ((file: File) => Readonly<Record<string, string>>) | undefined;
readonly withCredentials?: boolean | undefined;
}
| Name | Signature | Description |
|---|---|---|
url | readonly url: string | ((file: File) => string); | Target URL, or a function of the file. |
methodoptional | readonly method?: string | undefined; | Default |
headersoptional | readonly headers?: Readonly<Record<string, string>> | ((file: File) => Readonly<Record<string, string>>) | undefined; | Request headers, or a function of the file (auth tokens, CSRF). |
fieldNameoptional | readonly fieldName?: string | undefined; | Multipart field name of the file. Default |
dataoptional | readonly data?: Readonly<Record<string, string>> | ((file: File) => Readonly<Record<string, string>>) | undefined; | Extra multipart fields sent with each file. |
withCredentialsoptional | readonly withCredentials?: boolean | undefined; | Sends cookies cross-origin. Default |