/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { UploadHttpHeaders } from './UploadHttpHeaders'; import { UploadFileInfo } from '..'; /** * Represents the async properties of the Upload component. */ export interface UploadAsyncProps { /** * By default, the selected files are immediately uploaded. * To change this behavior, set `autoUpload` to `false`. */ autoUpload?: boolean; /** * When enabled, all files in the selection are uploaded in one request. * Any files that are selected one after the other are uploaded in separate requests. */ batch?: boolean; /** * Configures whether credentials (cookies, headers) will be sent for cross-site requests. * Defaults to `true`. Setting `withCredentials` has no effect on same-site requests. * To add credentials to the request, use the `saveHeaders` or `removeHeaders` property. */ withCredentials?: boolean; /** * Sets the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key which * contains the files submitted to `saveUrl`. Defaults to `files`. */ saveField?: string; /** * Configures the `HttpHeaders` that are attached to each upload request. */ saveHeaders?: UploadHttpHeaders; /** * Sets the [`request`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) method of the upload request. * Defaults to `POST`. */ saveMethod?: string; /** * Sets the URL of the endpoint for the upload request. * The requested [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key is named after * the `saveField` property and contains the list of files that will be uploaded. */ saveUrl?: string | ((files: UploadFileInfo[], options: { formData: FormData; requestOptions: any; }, onProgress: (uid: string, event: ProgressEvent) => void) => Promise<{ uid: string; }>); /** * Sets the expected [response type](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType) * of the server. * Used to parse the response appropriately. * Defaults to `json`. */ responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'; /** * Sets the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key * which contains the list of file names that are submitted to `removeUrl`. * Defaults to `fileNames`. */ removeField?: string; /** * Configures the `HttpHeaders` that are attached to each `remove` request. */ removeHeaders?: UploadHttpHeaders; /** * Sets the [request method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) of the `remove` request. * Defaults to `POST`. */ removeMethod?: string; /** * Sets the URL of the endpoint for the `remove` request. * The [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) request * key is named after the `removeField` property. * It contains the list of file names which will be removed. */ removeUrl?: string | ((files: UploadFileInfo[], options: { formData: FormData; requestOptions: any; }) => Promise<{ uid: string; }>); }