@serenity-is/corelib / UploaderOptions
Interface: UploaderOptions
Table of contents
Properties
- accept
- autoClear
- batchHandler
- batchProgress
- batchSize
- batchStart
- batchStop
- batchSuccess
- changeCallback
- dropZone
- errorHandler
- ignoreType
- input
- multiple
- name
Properties
accept
• Optional accept: string
Accept. If not specified, read from the passed input
Defined in
autoClear
• Optional autoClear: boolean
Auto clear input value after selection, so when same file selected it works. Default is true
Defined in
batchHandler
• Optional batchHandler: (batch: UploaderBatch, uploader: Uploader) => void | Promise<void>
Callback to handle a batch. If not specified, a default handler is used.
Type declaration
▸ (batch, uploader): void | Promise<void>
Parameters
| Name | Type |
|---|---|
batch |
UploaderBatch |
uploader |
Uploader |
Returns
void | Promise<void>
Defined in
batchProgress
• Optional batchProgress: (data: { batch: UploaderBatch ; loaded: number ; total: number }) => void
Progress event that is called during upload
Type declaration
▸ (data): void
Parameters
| Name | Type |
|---|---|
data |
Object |
data.batch |
UploaderBatch |
data.loaded |
number |
data.total |
number |
Returns
void
Defined in
batchSize
• Optional batchSize: number
Only used for multiple, default is 1 to upload multiple files in batches of size 1
Defined in
batchStart
• Optional batchStart: (data: { batch: UploaderBatch }) => void
Progress event that is called when a batch is about to be uploaded
Type declaration
▸ (data): void
Parameters
| Name | Type |
|---|---|
data |
Object |
data.batch |
UploaderBatch |
Returns
void
Defined in
batchStop
• Optional batchStop: (data: { batch: UploaderBatch }) => void
Progress event that is called when a batch is ended uploading or failed
Type declaration
▸ (data): void
Parameters
| Name | Type |
|---|---|
data |
Object |
data.batch |
UploaderBatch |
Returns
void
Defined in
batchSuccess
• Optional batchSuccess: (data: UploaderSuccessData) => void
Called after batch is uploaded successfully
Type declaration
▸ (data): void
Parameters
| Name | Type |
|---|---|
data |
UploaderSuccessData |
Returns
void
Defined in
changeCallback
• Optional changeCallback: (e: Event) => void
Only called when a change/drop event occurs, but files can't be determined
Type declaration
▸ (e): void
Parameters
| Name | Type |
|---|---|
e |
Event |
Returns
void
Defined in
dropZone
• Optional dropZone: HTMLElement | ArrayLike<HTMLElement>
An optional list of dropzones.
Defined in
errorHandler
• Optional errorHandler: (data: UploaderErrorData) => void
Error handler, if not specified Uploader.errorHandler is used
Type declaration
▸ (data): void
Parameters
| Name | Type |
|---|---|
data |
UploaderErrorData |
Returns
void
Defined in
ignoreType
• Optional ignoreType: boolean
Ignore file types, e.g. don't check accept property of input or this options
Defined in
input
• Optional input: HTMLInputElement
Target input. If null, dropZone should be specified.
Defined in
multiple
• Optional multiple: boolean
Allow multiple files. If not specified is read from the input
Defined in
name
• Optional name: string
The field name to use in FormData object. Default is files[]