
# Class: AuWidgetUploader

A widget that is used to upload files to a server.

```
{
  "widgets": [
    {
      "name": "logo-upload",
      "type": "uploader",
      "params": {
        "multiple": false,
        "text": "Upload logo",
        "destination": "{{ vars.backendUrl  + '/api/upload/image' }}",
        "fileTypes": [ ".jpg", ".jpeg", ".png", ".svg" ],
        "buttonText": "click me"
      }
    }
  ]
}
```

## Hierarchy

  ↳ [AuBaseWidget](aubasewidget.md)

  ↳ **AuWidgetUploader**

## Implements

* [IWidget](../interfaces/iwidget.md)

## Index

### Properties

* [errorResponse](auwidgetuploader.md#errorresponse)
* [httpCode](auwidgetuploader.md#httpcode)
* [params](auwidgetuploader.md#params)
* [response](auwidgetuploader.md#response)
* [responseType](auwidgetuploader.md#responsetype)
* [statusText](auwidgetuploader.md#statustext)

### Accessors

* [_](auwidgetuploader.md#_)

### Methods

* [checkInitDependenciesWidgets](auwidgetuploader.md#checkinitdependencieswidgets)
* [resetPreloaderState](auwidgetuploader.md#resetpreloaderstate)
* [showPreloader](auwidgetuploader.md#showpreloader)
* [showToast](auwidgetuploader.md#showtoast)

## Properties

###  errorResponse

• **errorResponse**: *any* = ""

___

###  httpCode

• **httpCode**: *number* = 0

___

###  params

• **params**: *[IUploaderConfig](../interfaces/iuploaderconfig.md)*

*Implementation of [IWidget](../interfaces/iwidget.md).[params](../interfaces/iwidget.md#optional-params)*

*Overrides [AuBaseWidget](aubasewidget.md).[params](aubasewidget.md#params)*

Properties of the widget.

___

###  response

• **response**: *any* =  null

___

###  responseType

• **responseType**: *string* = "json"

___

###  statusText

• **statusText**: *string* = ""

## Accessors

###  _

• **get _**(): *boolean*

Returns the response.

**Returns:** *boolean*

## Methods

###  checkInitDependenciesWidgets

▸ **checkInitDependenciesWidgets**(): *string[]*

*Inherited from [AuBaseWidget](aubasewidget.md).[checkInitDependenciesWidgets](aubasewidget.md#checkinitdependencieswidgets)*

Returns an array of widget names, due to which the current widget cannot receive parameters.

**Returns:** *string[]*

___

###  resetPreloaderState

▸ **resetPreloaderState**(): *void*

*Inherited from [AuBaseWidget](aubasewidget.md).[resetPreloaderState](aubasewidget.md#resetpreloaderstate)*

**Returns:** *void*

___

###  showPreloader

▸ **showPreloader**(`isPreload`: boolean, `message`: string | string[], `timeout`: number): *void*

*Inherited from [AuBaseWidget](aubasewidget.md).[showPreloader](aubasewidget.md#showpreloader)*

Shows a preloader.

```
"onClick": [
  "{{#function main.showPreloader(true, 'Creating print files...')}}",
  "{{#function $['editor'].getHiResImages(800,800)}}",
  "{{#function main.showPreloader(false)}}"
]
```

**Parameters:**

Name | Type | Default | Description |
------ | ------ | ------ | ------ |
`isPreload` | boolean | - | If `true`, enables the preloader. |
`message` | string &#124; string[] |  [""] | A text message that appears next to the preloader.  |
`timeout` | number | 5 | - |

**Returns:** *void*

___

###  showToast

▸ **showToast**(`data?`: string, `duration?`: number): *void*

*Inherited from [AuBaseWidget](aubasewidget.md).[showToast](aubasewidget.md#showtoast)*

Shows a toast.

```
return editor.loadUserInfo(data)
    .catch(err => {
        this.widget.showToast("Error: Invalid data");
        console.log(err);
    });
```

**Parameters:**

Name | Type | Description |
------ | ------ | ------ |
`data?` | string | A string message to display in the toast. |
`duration?` | number | Defines how long to show the toast for.  |

**Returns:** *void*
