---
title: "IUploaderOptions"
---
# IUploaderOptions

Defined in: [src/types/uploader.d.ts:38](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L38)

## Type Parameters

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

### url

**url**: `string` \| ((`request`) => `string`)

Defined in: [src/types/uploader.d.ts:39](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L39)

***

### insertImageAsBase64URI

**insertImageAsBase64URI**: `boolean`

Defined in: [src/types/uploader.d.ts:41](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L41)

***

### showTabInFileSelector

**showTabInFileSelector**: `boolean`

Defined in: [src/types/uploader.d.ts:58](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L58)

Show the `Upload` tab in the image/file insert popup.
Set to `false` when the uploader is configured only for the
file browser and direct drag-and-drop upload should not be offered.

#### Default

```ts
true
```

#### Example

```javascript
Jodit.make('#editor', {
  uploader: {
    url: 'https://example.com/upload',
    showTabInFileSelector: false
  }
});
```

***

### imagesExtensions

**imagesExtensions**: `string`[]

Defined in: [src/types/uploader.d.ts:73](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L73)

List of extensions for images

#### Default

```ts
['jpg', 'png', 'jpeg', 'gif']
```

#### Example

```javascript
Jodit.make('#editor', {
  uploader: {
    insertImageAsBase64URI: true,
    imagesExtensions: ['jpg', 'png', 'jpeg', 'gif', 'svg', 'webp']
  }
});
```

***

### headers?

`optional` **headers?**: [`IDictionary`](../modules/types.html#idictionary)\<`string`\> \| ((`this`) => [`CanPromise`](../modules/types.html#canpromise)\<[`IDictionary`](../modules/types.html#idictionary)\<`string`\> \| `null`\>) \| `null`

Defined in: [src/types/uploader.d.ts:74](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L74)

***

### data

**data**: `object` \| `null`

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

***

### format

**format**: `string`

Defined in: [src/types/uploader.d.ts:79](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L79)

***

### method

**method**: `string`

Defined in: [src/types/uploader.d.ts:80](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L80)

***

### filesVariableName

**filesVariableName**: (`i`) => `string`

Defined in: [src/types/uploader.d.ts:82](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L82)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `i` | `number` |

#### Returns

`string`

***

### pathVariableName

**pathVariableName**: `string`

Defined in: [src/types/uploader.d.ts:118](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L118)

***

### withCredentials

**withCredentials**: `boolean`

Defined in: [src/types/uploader.d.ts:119](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L119)

***

### beforeUpload?

`optional` **beforeUpload?**: (`this`, `files`) => `boolean` \| `void`

Defined in: [src/types/uploader.d.ts:143](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L143)

Called with the list of files right before they are uploaded (or read as
base64). Return `false` to abort the whole upload — useful for client
side validation (size, type, count). Throwing an Error also aborts and
routes the message through the uploader error handler.

```javascript
Jodit.make('#editor', {
  uploader: {
    url: '...',
    beforeUpload(files) {
      for (const file of files) {
        if (file.size > 2 * 1024 * 1024) {
          this.jodit.message.error('Max 2MB');
          return false;
        }
      }
    }
  }
});
```

#### Parameters

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

#### Returns

`boolean` \| `void`

***

### prepareData

**prepareData**: (`this`, `formData`) => `any`

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

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `this` | `T` |
| `formData` | [`FormData`](https://developer.mozilla.org/docs/Web/API/FormData) |

#### Returns

`any`

***

### buildData?

`optional` **buildData?**: (`this`, `formData`) => [`BuildDataResult`](../modules/types.html#builddataresult)

Defined in: [src/types/uploader.d.ts:146](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L146)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `this` | `T` |
| `formData` | `any` |

#### Returns

[`BuildDataResult`](../modules/types.html#builddataresult)

***

### queryBuild?

`optional` **queryBuild?**: (`obj`, `prefix?`) => `string` \| [`FormData`](https://developer.mozilla.org/docs/Web/API/FormData)

Defined in: [src/types/uploader.d.ts:147](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L147)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `obj` | `string` \| [`FormData`](https://developer.mozilla.org/docs/Web/API/FormData) \| [`IDictionary`](../modules/types.html#idictionary)\<`string` \| `object`\> |
| `prefix?` | `string` |

#### Returns

`string` \| [`FormData`](https://developer.mozilla.org/docs/Web/API/FormData)

***

### isSuccess

**isSuccess**: (`this`, `resp`) => `boolean`

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

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `this` | `T` |
| `resp` | [`IUploaderAnswer`](./types.IUploaderAnswer.html) |

#### Returns

`boolean`

***

### getMessage

**getMessage**: (`this`, `resp`) => `string`

Defined in: [src/types/uploader.d.ts:154](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L154)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `this` | `T` |
| `resp` | [`IUploaderAnswer`](./types.IUploaderAnswer.html) |

#### Returns

`string`

***

### process

**process**: (`this`, `resp`) => [`IUploaderData`](./types.IUploaderData.html)

Defined in: [src/types/uploader.d.ts:156](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L156)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `this` | `T` |
| `resp` | [`IUploaderAnswer`](./types.IUploaderAnswer.html) |

#### Returns

[`IUploaderData`](./types.IUploaderData.html)

***

### error

**error**: (`this`, `e`) => `void`

Defined in: [src/types/uploader.d.ts:158](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L158)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `this` | `T` |
| `e` | [`Error`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error) |

#### Returns

`void`

***

### defaultHandlerSuccess

**defaultHandlerSuccess**: [`HandlerSuccess`](../modules/types.html#handlersuccess)

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

***

### defaultHandlerError

**defaultHandlerError**: [`HandlerError`](../modules/types.html#handlererror)

Defined in: [src/types/uploader.d.ts:161](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L161)

***

### contentType

**contentType**: (`this`, `requestData`) => `string` \| `false`

Defined in: [src/types/uploader.d.ts:163](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L163)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `this` | `T` |
| `requestData` | `any` |

#### Returns

`string` \| `false`

***

### customUploadFunction?

`optional` **customUploadFunction?**: (`requestData`, `showProgress`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`IUploaderAnswer`](./types.IUploaderAnswer.html)\>

Defined in: [src/types/uploader.d.ts:178](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L178)

This method can be used to replace the function of uploading files
```javascript
Jodit.make('#editor', {
  uploader: {
    customUploadFunction: (requestData, showProgress) => fetch(requestData).then((res)=>{
      showProgress(100)
      return res.json()
    })
  }
});
```

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `requestData` | `any` |
| `showProgress` | (`progress`) => `void` |

#### Returns

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

### processFileName()

**processFileName**(`this`, `key`, `file`, `name`): \[`string`, [`File`](https://developer.mozilla.org/docs/Web/API/File), `string`\]

Defined in: [src/types/uploader.d.ts:98](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L98)

The method can be used to change the name of the uploaded file
This is the name the file will have when it is sent to the server
```js
Jodit.make('#editor', {
 uploader: {
   url: 'some-connector.php',
   processFileName: (key, file, name) => {
     return [key, file, 'some-prefix_' + name];
   }
 }
});
```

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `this` | `T` |
| `key` | `string` |
| `file` | [`File`](https://developer.mozilla.org/docs/Web/API/File) |
| `name` | `string` |

#### Returns

\[`string`, [`File`](https://developer.mozilla.org/docs/Web/API/File), `string`\]

***

### getDisplayName()

**getDisplayName**(`this`, `baseurl`, `filename`): `string`

Defined in: [src/types/uploader.d.ts:116](https://github.com/xdan/jodit/blob/main/src/types/uploader.d.ts#L116)

The method can be used to change the displayed name of the uploaded file
```javascript
Jodit.make('#editor', {
  uploader: {
    url: 'https://sitename.net/jodit/connector/index.php?action=fileUpload',
    getDisplayName: (_, name) => 'File:' + name
  }
});
```

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `this` | `T` |
| `baseurl` | `string` |
| `filename` | `string` |

#### Returns

`string`
