---
title: "Uploader"
---
# Uploader

Defined in: [src/modules/uploader/uploader.ts:47](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L47)

The base class of all Jodit UI components. Provides work with a life cycle.

## Extends

- [`ViewComponent`](./component.ViewComponent.html)

## Implements

- [`IUploader`](../interfaces/types.IUploader.html)

### Constructor

**new Uploader**(`editor`, `options?`): `Uploader`

Defined in: [src/modules/uploader/uploader.ts:304](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L304)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `editor` | [`IViewBased`](../interfaces/types.IViewBased.html) |
| `options?` | [`IUploaderOptions`](../interfaces/types.IUploaderOptions.html)\<`Uploader`\> |

#### Returns

`Uploader`

#### Overrides

[`ViewComponent`](./component.ViewComponent.html).[`constructor`](./component.ViewComponent.html#constructor)

### STATUSES

`static` **STATUSES**: `object`

Defined in: [src/core/component/component.ts:40](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L40)

#### beforeInit

`readonly` **beforeInit**: `"beforeInit"` = `'beforeInit'`

#### ready

`readonly` **ready**: `"ready"` = `'ready'`

#### beforeDestruct

`readonly` **beforeDestruct**: `"beforeDestruct"` = `'beforeDestruct'`

#### destructed

`readonly` **destructed**: `"destructed"` = `'destructed'`

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`STATUSES`](./component.ViewComponent.html#statuses)

***

### async

**async**: [`IAsync`](../interfaces/types.IAsync.html)

Defined in: [src/core/component/component.ts:44](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L44)

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`async`](../interfaces/types.IUploader.html#async)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`async`](./component.ViewComponent.html#async)

***

### uid

`readonly` **uid**: `string`

Defined in: [src/core/component/component.ts:59](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L59)

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`uid`](../interfaces/types.IUploader.html#uid)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`uid`](./component.ViewComponent.html#uid)

***

### ownerWindow

**ownerWindow**: [`Window`](https://developer.mozilla.org/docs/Web/API/Window) = `window`

Defined in: [src/core/component/component.ts:109](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L109)

The window in which jodit was created

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`ownerWindow`](../interfaces/types.IUploader.html#ownerwindow)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`ownerWindow`](./component.ViewComponent.html#ownerwindow)

***

### jodit

`readonly` **jodit**: [`IViewBased`](../interfaces/types.IViewBased.html)

Defined in: [src/modules/uploader/uploader.ts:48](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L48)

Parent View element

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`jodit`](../interfaces/types.IUploader.html#jodit)

#### Overrides

[`ViewComponent`](./component.ViewComponent.html).[`jodit`](./component.ViewComponent.html#jodit)

***

### path

**path**: `string` = `''`

Defined in: [src/modules/uploader/uploader.ts:59](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L59)

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`path`](../interfaces/types.IUploader.html#path)

***

### source

**source**: `string` = `'default'`

Defined in: [src/modules/uploader/uploader.ts:60](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L60)

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`source`](../interfaces/types.IUploader.html#source)

***

### options

`readonly` **options**: [`IUploaderOptions`](../interfaces/types.IUploaderOptions.html)\<[`IUploader`](../interfaces/types.IUploader.html)\>

Defined in: [src/modules/uploader/uploader.ts:62](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L62)

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`options`](../interfaces/types.IUploader.html#options)

#### Get Signature

**get** **componentName**(): `string`

Defined in: [src/core/component/component.ts:46](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L46)

##### Returns

`string`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`componentName`](../interfaces/types.IUploader.html#componentname)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`componentName`](./component.ViewComponent.html#componentname)

***

#### Get Signature

**get** **ownerDocument**(): [`Document`](https://developer.mozilla.org/docs/Web/API/Document)

Defined in: [src/core/component/component.ts:95](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L95)

The document in which jodit was created

##### Returns

[`Document`](https://developer.mozilla.org/docs/Web/API/Document)

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`ownerDocument`](../interfaces/types.IUploader.html#ownerdocument)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`ownerDocument`](./component.ViewComponent.html#ownerdocument)

***

#### Get Signature

**get** **od**(): [`Document`](https://developer.mozilla.org/docs/Web/API/Document)

Defined in: [src/core/component/component.ts:102](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L102)

Shortcut for `this.ownerDocument`

##### Returns

[`Document`](https://developer.mozilla.org/docs/Web/API/Document)

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`od`](../interfaces/types.IUploader.html#od)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`od`](./component.ViewComponent.html#od)

***

#### Get Signature

**get** **ow**(): [`Window`](https://developer.mozilla.org/docs/Web/API/Window)

Defined in: [src/core/component/component.ts:110](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L110)

##### Returns

[`Window`](https://developer.mozilla.org/docs/Web/API/Window)

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`ow`](../interfaces/types.IUploader.html#ow)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`ow`](./component.ViewComponent.html#ow)

***

#### Get Signature

**get** **isReady**(): `boolean`

Defined in: [src/core/component/component.ts:145](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L145)

Component is ready for work

##### Returns

`boolean`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`isReady`](../interfaces/types.IUploader.html#isready)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`isReady`](./component.ViewComponent.html#isready)

***

#### Get Signature

**get** **isDestructed**(): `boolean`

Defined in: [src/core/component/component.ts:152](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L152)

Component was destructed

##### Returns

`boolean`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`isDestructed`](../interfaces/types.IUploader.html#isdestructed)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`isDestructed`](./component.ViewComponent.html#isdestructed)

***

#### Get Signature

**get** **isInDestruct**(): `boolean`

Defined in: [src/core/component/component.ts:160](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L160)

The component is currently undergoing destructuring or has already been destroyed.
Those. you should not the app froze new events on him now or do anything else with him.

##### Returns

`boolean`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`isInDestruct`](../interfaces/types.IUploader.html#isindestruct)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`isInDestruct`](./component.ViewComponent.html#isindestruct)

***

#### Get Signature

**get** **componentStatus**(): [`ComponentStatus`](../modules/types.html#componentstatus)

Defined in: [src/core/component/component.ts:210](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L210)

Current component status

##### Returns

[`ComponentStatus`](../modules/types.html#componentstatus)

#### Set Signature

**set** **componentStatus**(`componentStatus`): `void`

Defined in: [src/core/component/component.ts:217](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L217)

Setter for current component status

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `componentStatus` | [`ComponentStatus`](../modules/types.html#componentstatus) |

##### Returns

`void`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`componentStatus`](../interfaces/types.IUploader.html#componentstatus)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`componentStatus`](./component.ViewComponent.html#componentstatus)

***

#### Get Signature

**get** **defaultTimeout**(): `number`

Defined in: [src/core/component/view-component.ts:31](https://github.com/xdan/jodit/blob/main/src/core/component/view-component.ts#L31)

##### Returns

`number`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`defaultTimeout`](../interfaces/types.IUploader.html#defaulttimeout)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`defaultTimeout`](./component.ViewComponent.html#defaulttimeout)

***

#### Get Signature

**get** **j**(): [`IViewBased`](../interfaces/types.IViewBased.html)

Defined in: [src/modules/uploader/uploader.ts:50](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L50)

Shortcut for `this.jodit`

##### Returns

[`IViewBased`](../interfaces/types.IViewBased.html)

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`j`](../interfaces/types.IUploader.html#j)

#### Overrides

[`ViewComponent`](./component.ViewComponent.html).[`j`](./component.ViewComponent.html#j)

***

#### Get Signature

**get** **o**(): `this`\[`"options"`\]

Defined in: [src/modules/uploader/uploader.ts:63](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L63)

##### Returns

`this`\[`"options"`\]

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`o`](../interfaces/types.IUploader.html#o)

#### Call Signature

**getFullElName**(`elementName`): `string`

Defined in: [src/core/component/component.ts:65](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L65)

Calc BEM element class name

##### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `elementName` | `string` | element name in the bem classification |

##### Returns

`string`

##### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`getFullElName`](../interfaces/types.IUploader.html#getfullelname)

##### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`getFullElName`](./component.ViewComponent.html#getfullelname)

#### Call Signature

**getFullElName**(`elementName`, `mod`): `string`

Defined in: [src/core/component/component.ts:66](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L66)

Calc BEM element class name

##### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `elementName` | `string` | element name in the bem classification |
| `mod` | `string` | - |

##### Returns

`string`

##### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`getFullElName`](../interfaces/types.IUploader.html#getfullelname)

##### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`getFullElName`](./component.ViewComponent.html#getfullelname)

#### Call Signature

**getFullElName**(`elementName`, `mod`, `modValue`): `string`

Defined in: [src/core/component/component.ts:67](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L67)

Calc BEM element class name

##### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `elementName` | `string` | element name in the bem classification |
| `mod` | `string` | - |
| `modValue` | `string` \| `boolean` | - |

##### Returns

`string`

##### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`getFullElName`](../interfaces/types.IUploader.html#getfullelname)

##### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`getFullElName`](./component.ViewComponent.html#getfullelname)

***

### get()

**get**\<`T`\>(`chain`, `obj?`): [`Nullable`](../modules/types.html#nullable)\<`T`\>

Defined in: [src/core/component/component.ts:138](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L138)

Safe get any field

#### Type Parameters

| Type Parameter |
| ------ |
| `T` |

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `chain` | `string` | the path to be traversed in the obj object |
| `obj?` | [`IDictionary`](../modules/types.html#idictionary) | the object in which the value is searched |

#### Returns

[`Nullable`](../modules/types.html#nullable)\<`T`\>

#### Example

```js
private a = {
  b: {
    c: {
      e: {
        g: {
          color: 'red'
        }
      }
    }
  }
}

this.get('a.b.c.e.g.color'); // Safe access to color
// instead using optionsl chaining
this?.a?.b?.c?.e?.g?.color
```

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`get`](../interfaces/types.IUploader.html#get)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`get`](./component.ViewComponent.html#get)

***

### bindDestruct()

**bindDestruct**(`component`): `this`

Defined in: [src/core/component/component.ts:170](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L170)

Bind destructor to some View

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `component` | [`IComponent`](../interfaces/types.IComponent.html) |

#### Returns

`this`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`bindDestruct`](../interfaces/types.IUploader.html#binddestruct)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`bindDestruct`](./component.ViewComponent.html#binddestruct)

***

### setStatus()

**setStatus**(`componentStatus`): `void`

Defined in: [src/core/component/component.ts:226](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L226)

Set component status

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `componentStatus` | [`ComponentStatus`](../modules/types.html#componentstatus) | component status |

#### Returns

`void`

#### See

ComponentStatus

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`setStatus`](../interfaces/types.IUploader.html#setstatus)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`setStatus`](./component.ViewComponent.html#setstatus)

***

### hookStatus()

**hookStatus**(`status`, `callback`): `void`

Defined in: [src/core/component/component.ts:265](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L265)

Adds a handler for changing the component's status

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `status` | [`ComponentStatus`](../modules/types.html#componentstatus) | the status at which the callback is triggered |
| `callback` | (`component`) => `void` | a function that will be called when the status is `status` |

#### Returns

`void`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`hookStatus`](../interfaces/types.IUploader.html#hookstatus)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`hookStatus`](./component.ViewComponent.html#hookstatus)

***

### isInstanceOf()

`static` **isInstanceOf**\<`T`\>(`c`, `constructorFunc`): `c is T`

Defined in: [src/core/component/component.ts:283](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L283)

#### Type Parameters

| Type Parameter |
| ------ |
| `T` *extends* [`Component`](./component.Component.html) |

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `c` | `unknown` |
| `constructorFunc` | [`Function`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function) |

#### Returns

`c is T`

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`isInstanceOf`](./component.ViewComponent.html#isinstanceof)

***

### i18n()

**i18n**(`text`, ...`params`): `string`

Defined in: [src/core/component/view-component.ts:35](https://github.com/xdan/jodit/blob/main/src/core/component/view-component.ts#L35)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `text` | `string` |
| ...`params` | (`string` \| `number`)[] |

#### Returns

`string`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`i18n`](../interfaces/types.IUploader.html#i18n)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`i18n`](./component.ViewComponent.html#i18n)

***

### setParentView()

**setParentView**(`jodit`): `this`

Defined in: [src/core/component/view-component.ts:42](https://github.com/xdan/jodit/blob/main/src/core/component/view-component.ts#L42)

Attach component to View

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `jodit` | [`IViewBased`](../interfaces/types.IViewBased.html) |

#### Returns

`this`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`setParentView`](../interfaces/types.IUploader.html#setparentview)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`setParentView`](./component.ViewComponent.html#setparentview)

***

### className()

**className**(): `string`

Defined in: [src/modules/uploader/uploader.ts:55](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L55)

#### Returns

`string`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`className`](../interfaces/types.IUploader.html#classname)

#### Overrides

[`ViewComponent`](./component.ViewComponent.html).[`className`](./component.ViewComponent.html#classname)

***

### setPath()

**setPath**(`path`): `this`

Defined in: [src/modules/uploader/uploader.ts:70](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L70)

It sets the path for uploading files

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `path` | `string` |

#### Returns

`this`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`setPath`](../interfaces/types.IUploader.html#setpath)

***

### setSource()

**setSource**(`source`): `this`

Defined in: [src/modules/uploader/uploader.ts:78](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L78)

It sets the source for connector

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `source` | `string` |

#### Returns

`this`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`setSource`](../interfaces/types.IUploader.html#setsource)

***

### bind()

**bind**(`form`, `handlerSuccess?`, `handlerError?`): `void`

Defined in: [src/modules/uploader/uploader.ts:103](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L103)

Set the handlers Drag and Drop to `$form`

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `form` | [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement) | Form or any Node on which you can drag and drop the file. In addition will be processed <code>&lt;input type="file" &gt;</code> |
| `handlerSuccess?` | [`HandlerSuccess`](../modules/types.html#handlersuccess) | The function be called when a successful uploading files to the server |
| `handlerError?` | [`HandlerError`](../modules/types.html#handlererror) | The function that will be called during a failed download files a server |

#### Returns

`void`

#### Example

```javascript
var $form = jQuery('<form><input type="text" typpe="file"></form>');
jQuery('body').append($form);
Jodit.editors.someidfoeditor.uploader.bind($form[0], function (files) {
    var i;
    for (i = 0; i < data.files.length; i += 1) {
        parent.s.insertImage(data.files[i])
    }
});
```

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`bind`](../interfaces/types.IUploader.html#bind)

***

### uploadRemoteImage()

**uploadRemoteImage**(`url`, `handlerSuccess?`, `handlerError?`): `void`

Defined in: [src/modules/uploader/uploader.ts:264](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L264)

Upload images to a server by its URL, making it through the connector server.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `url` | `string` |
| `handlerSuccess?` | [`HandlerSuccess`](../modules/types.html#handlersuccess) |
| `handlerError?` | [`HandlerError`](../modules/types.html#handlererror) |

#### Returns

`void`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`uploadRemoteImage`](../interfaces/types.IUploader.html#uploadremoteimage)

***

### upload()

**upload**(`files`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`IUploaderData`](../interfaces/types.IUploaderData.html)\>

Defined in: [src/modules/uploader/uploader.ts:298](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L298)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `files` | [`FileList`](https://developer.mozilla.org/docs/Web/API/FileList) \| [`File`](https://developer.mozilla.org/docs/Web/API/File)[] \| `null` |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`IUploaderData`](../interfaces/types.IUploaderData.html)\>

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`upload`](../interfaces/types.IUploader.html#upload)

***

### destruct()

**destruct**(): `any`

Defined in: [src/modules/uploader/uploader.ts:316](https://github.com/xdan/jodit/blob/main/src/modules/uploader/uploader.ts#L316)

#### Returns

`any`

#### Implementation of

[`IUploader`](../interfaces/types.IUploader.html).[`destruct`](../interfaces/types.IUploader.html#destruct)

#### Overrides

[`ViewComponent`](./component.ViewComponent.html).[`destruct`](./component.ViewComponent.html#destruct)
