---
title: "tinymce.EditorUpload"
description: "TinyMCE Editor Upload API Handles image uploads, updates undo stack and patches over various internal functions."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.editorupload/"
md_url: "https://www.tiny.cloud/docs/tinymce/6/apis/tinymce.editorupload/index.md"
version: "6"
last_updated: "2023-06-13T00:28:34Z"
tokens: 750
---
Important This page documents TinyMCE 6. For new projects, Tiny recommends using the latest, most up-to-date version. [See TinyMCE 8 documentation](../../../latest/apis/tinymce.editorupload/).
# tinymce.EditorUpload

TinyMCE Editor Upload API Handles image uploads, updates undo stack and patches over various internal functions.

## Examples

```javascript
// Apply a new filter within the image scan.
tinymce.activeEditor.EditorUpload.addFilter((image) => {
  const maxSize = 1920 * 1080;
  const imageSize = image.width * image.height;
  return imageSize < maxSize;
});

// Upload all valid images in the editor
tinymce.activeEditor.EditorUpload.uploadImages();

// Scan the editor for valid images
tinymce.activeEditor.EditorUpload.scanForImages();
```

## Summary

### Properties

| Name | Type | Summary | Defined by |
| --- | --- | --- | --- |
| blobCache | `Object` | Cache of blob elements created in an editor instance. | `EditorUpload` |

### Methods

| Name | Summary | Defined by |
| --- | --- | --- |
| [addFilter()](#addFilter) | Adds a custom filter that controls the images which are included in the scan. Images must return true on every added filter to be considered valid. | `EditorUpload` |
| [destroy()](#destroy) | Resets the blob data and upload status of all uploaded images. Called automatically on `editor.remove`. This method is not recommended for integration. | `EditorUpload` |
| [scanForImages()](#scanForImages) | Scans the editor content for valid image elements and generates blob information for each image. | `EditorUpload` |
| [uploadImages()](#uploadImages) | Uploads all the data uri/blob uri images scanned from the editor content to the server. | `EditorUpload` |
| [uploadImagesAuto()](#uploadImagesAuto) | Uploads all data uri/blob uri images to the server only when automatic uploads are enabled. | `EditorUpload` |

## Methods

### addFilter()

```javascript
addFilter(filter: Function)
```
Adds a custom filter that controls the images which are included in the scan.
Images must return true on every added filter to be considered valid.

#### Examples

```javascript
// Filter which images are uploaded.
tinymce.activeEditor.EditorUpload.addFilter((image) => {
  const maxSize = 1920 * 1080;
  const imageSize = image.width * image.height;
  return imageSize < maxSize;
});
```

#### Parameters

- `filter (Function)` - Function which filters each image upload.

### destroy()

```javascript
destroy()
```
Resets the blob data and upload status of all uploaded images. Called automatically on `editor.remove`.
This method is not recommended for integration.

### scanForImages()

```javascript
scanForImages(): Promise
```
Scans the editor content for valid image elements and generates blob information for each image.

#### Return value

- `Promise` - Promise instance with element object and blob information for each image.

### uploadImages()

```javascript
uploadImages(): Promise
```
Uploads all the data uri/blob uri images scanned from the editor content to the server.

#### Return value

- `Promise` - Promise instance with images and status for each image.

### uploadImagesAuto()

```javascript
uploadImagesAuto(): Promise
```
Uploads all data uri/blob uri images to the server only when automatic uploads are enabled.

#### Return value

- `Promise` - Promise instance with images and status for each image.
