diff --git a/src/asset_manager/config/config.ts b/src/asset_manager/config/config.ts index 4e08866a3..09c5def67 100644 --- a/src/asset_manager/config/config.ts +++ b/src/asset_manager/config/config.ts @@ -46,10 +46,15 @@ export interface AssetManagerConfig { */ credentials?: RequestCredentials; /** - * Allow uploading multiple files per request. If disabled filename will not have '[]' appended. + * Allow uploading multiple files per request. If disabled filename will not have the 'multiUploadSuffix' appended. * @default true */ multiUpload?: boolean; + /** + * The suffix to append to 'uploadName' when 'multiUpload' is true. + * @default '[]' + */ + multiUploadSuffix?: string; /** * If true, tries to add automatically uploaded assets. To make it work the server should respond with a JSON containing assets in a data key, eg: * { data: [ 'https://.../image.png', {src: 'https://.../image2.png'} ] @@ -146,6 +151,7 @@ const config: AssetManagerConfig = { params: {}, credentials: 'include', multiUpload: true, + multiUploadSuffix: '[]', autoAdd: true, customFetch: undefined, uploadFile: undefined, diff --git a/src/asset_manager/view/FileUploader.ts b/src/asset_manager/view/FileUploader.ts index 47e6c4bd5..b37fc4c8c 100644 --- a/src/asset_manager/view/FileUploader.ts +++ b/src/asset_manager/view/FileUploader.ts @@ -155,7 +155,7 @@ export default class FileUploaderView extends View { if (this.multiUpload) { for (let i = 0; i < files.length; i++) { - body.append(`${config.uploadName}[]`, files[i]); + body.append(`${config.uploadName}${config.multiUploadSuffix}`, files[i]); } } else if (files.length) { body.append(config.uploadName!, files[0]);