---
title: "Media Optimizer (Files and Documents)"
description: "The Files and Documents feature of the Media Optimizer plugin allows you to upload and link document files in your content."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/uploadcare-documents/"
md_url: "https://www.tiny.cloud/docs/tinymce/latest/uploadcare-documents/index.md"
version: "latest"
last_updated: "2026-03-09T01:59:33Z"
tokens: 3295
---
# Media Optimizer (Files and Documents)

> **Note:** This plugin is only available for [paid TinyMCE subscriptions](/pricing/).

## Overview

The Documents feature of the Media Optimizer’s Files and Documents feature plugin enables users to upload and link document files (PDF, Word, Excel, PowerPoint, and more) directly within the editor through the [Link](../link/) plugin’s dialog. The plugin automatically configures the necessary options to enable file uploads in the link dialog when both the Media Optimizer’s Files and Documents feature plugin and the Link plugin are enabled.

## Key benefits

- Upload and link document files directly within the editor
- Support for a wide range of file types including documents, iWork files, audio files, and archives
- Automatic configuration of file upload handlers when both plugins are enabled
- Secure file uploads through Uploadcare’s infrastructure
- Customizable list of supported file types
- Drag-and-drop file upload support
- URL-based file linking

## Interactive example

**Example**

```js
tinymce.init({
  selector: 'textarea',
  plugins: 'uploadcare link',
  toolbar: "undo redo | styles | bold italic underline | forecolor | bullist numlist | link uploadcare uploadcare-video | code preview",
  uploadcare_public_key: '<your-public-key>',
  documents_file_types: [
    { mimeType: 'application/msword', extensions: [ 'doc' ] },
    { mimeType: 'application/vnd.ms-excel', extensions: [ 'xls' ] },
    { mimeType: 'application/vnd.ms-powerpoint', extensions: [ 'ppt', 'pps' ] },
    { mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', extensions: [ 'docx' ] },
    { mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', extensions: [ 'xlsx' ] },
    { mimeType: 'application/vnd.openxmlformats-officedocument.presentationml.presentation', extensions: [ 'pptx' ] },
    { mimeType: 'application/pdf', extensions: [ 'pdf' ] },
    { mimeType: 'application/rtf', extensions: [ 'rtf' ] },
    { mimeType: 'text/plain', extensions: [ 'txt' ] },
    { mimeType: 'application/vnd.apple.keynote', extensions: [ 'key' ] },
    { mimeType: 'application/vnd.apple.pages', extensions: [ 'pages' ] },
    { mimeType: 'application/vnd.apple.numbers', extensions: [ 'numbers' ] },
    { mimeType: 'audio/wav', extensions: [ 'wav', 'wave' ] },
    { mimeType: 'audio/mpeg', extensions: [ 'mp3' ] },
    { mimeType: 'audio/ogg', extensions: [ 'ogg' ] },
    { mimeType: 'application/zip', extensions: [ 'zip' ] },
    { mimeType: 'application/gzip', extensions: [ 'gz', 'gzip' ] },
    { mimeType: 'application/x-tar', extensions: [ 'tar' ] },
    { mimeType: 'application/x-gtar', extensions: [ 'tar.gz', 'tgz' ] },
    { mimeType: 'application/x-compressed-tar', extensions: [ 'tar.gz', 'tgz' ] },
    { mimeType: 'application/x-7z-compressed', extensions: [ '7z' ] },
    { mimeType: 'application/vnd.rar', extensions: [ 'rar' ] }
  ]
});
```

## Basic setup

To enable document file uploads, include both `uploadcare` and `link` in the `plugins` option in the editor configuration. The Media Optimizer’s Files and Documents feature plugin will automatically configure the necessary options to enable file uploads in the link dialog.

Example
```js
tinymce.init({
  selector: 'textarea',
  plugins: 'uploadcare link',
  toolbar: 'link',
  uploadcare_public_key: '<your-public-key>',
  documents_file_types: [
    { mimeType: 'application/msword', extensions: [ 'doc' ] },
    { mimeType: 'application/vnd.ms-excel', extensions: [ 'xls' ] },
    { mimeType: 'application/vnd.ms-powerpoint', extensions: [ 'ppt', 'pps' ] },
    { mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', extensions: [ 'docx' ] },
    { mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', extensions: [ 'xlsx' ] },
    { mimeType: 'application/vnd.openxmlformats-officedocument.presentationml.presentation', extensions: [ 'pptx' ] },
    { mimeType: 'application/pdf', extensions: [ 'pdf' ] },
    { mimeType: 'application/rtf', extensions: [ 'rtf' ] },
    { mimeType: 'text/plain', extensions: [ 'txt' ] },
    { mimeType: 'application/vnd.apple.keynote', extensions: [ 'key' ] },
    { mimeType: 'application/vnd.apple.pages', extensions: [ 'pages' ] },
    { mimeType: 'application/vnd.apple.numbers', extensions: [ 'numbers' ] },
    { mimeType: 'audio/wav', extensions: [ 'wav', 'wave' ] },
    { mimeType: 'audio/mpeg', extensions: [ 'mp3' ] },
    { mimeType: 'audio/ogg', extensions: [ 'ogg' ] },
    { mimeType: 'application/zip', extensions: [ 'zip' ] },
    { mimeType: 'application/gzip', extensions: [ 'gz', 'gzip' ] },
    { mimeType: 'application/x-tar', extensions: [ 'tar' ] },
    { mimeType: 'application/x-gtar', extensions: [ 'tar.gz', 'tgz' ] },
    { mimeType: 'application/x-compressed-tar', extensions: [ 'tar.gz', 'tgz' ] },
    { mimeType: 'application/x-7z-compressed', extensions: [ '7z' ] },
    { mimeType: 'application/vnd.rar', extensions: [ 'rar' ] }
  ]
});
```

> **Note:** For information on bundling this plugin with module bundlers, see [Bundling TinyMCE - Overview](../bundling-guide/).

> **Note:** The Media Optimizer’s Files and Documents feature plugin automatically configures the [`files_upload_handler`](../link/#files_upload_handler) and `documents_file_types` options when both the Link plugin and the Media Optimizer’s Files and Documents feature plugin are enabled. This enables file uploads in the Link dialog without requiring manual configuration. However, you can customize the list of supported file types by explicitly setting the [`documents_file_types`](../uploadcare/#documents-file-types) option as shown in the example above.

## Document Operations

Below is an overview of the features provided by the Media Optimizer’s Files and Documents feature plugin for document file uploads:

| Toolbar button | Icon | Description |
| --- | --- | --- |
| `link` | ![link.svg](../_images/icons/link.svg) | Opens the Insert/edit link dialog so the user can upload with file picker or dropping file to be uploaded. Uploaded files are processed through Uploadcare’s infrastructure and automatically linked in the content. |

The Media Optimizer’s Files and Documents feature plugin supports a comprehensive list of file types:

- **Documents:** PDF, Word (doc, docx), Excel (xls, xlsx), PowerPoint (ppt, pps, pptx), RTF, plain text (txt)
- **iWork files:** Keynote (key), Pages (pages), Numbers (numbers)
- **Audio files:** WAV (wav, wave), MP3 (mp3), OGG (ogg)
- **Archive files:** ZIP (zip), GZIP (gz, gzip), TAR (tar), TAR.GZ (tar.gz, tgz), 7Z (7z), RAR (rar)

When both the Media Optimizer’s Files and Documents feature plugin and the Link plugin are enabled, the Link dialog displays an "Upload" tab that enables file uploads. Users can upload files via drag-and-drop, file selection, or by providing a URL. Uploaded files are processed through Uploadcare’s infrastructure and automatically linked in the content.

## Options

The following configuration options affect the behavior of the Files and Documents feature:

### `documents_file_types`

This option specifies which file types (MIME types and extensions) are supported for file uploads in the link dialog when using the Media Optimizer plugin. When both the [Link](../link/) plugin and the Media Optimizer plugin are enabled, the Media Optimizer plugin automatically configures this option to enable file uploads in the link dialog.

The option should be a non-empty array of objects, where each object contains:

- `mimeType` - A string representing the MIME type (e.g., `'application/pdf'`)
- `extensions` - An array of strings representing the file extensions (e.g., `['pdf']`)

> **Important:** If `documents_file_types` is set to an empty array or is not a valid array of objects matching the configuration schema, the Media Optimizer plugin will throw an error: "Must be a non-empty array of objects matching the configuration schema."
When the Media Optimizer plugin is enabled with the `link` plugin, it automatically sets a default list of supported file types. The default list includes:

- **Documents:** PDF, Word (doc, docx), Excel (xls, xlsx), PowerPoint (ppt, pps, pptx), RTF, plain text (txt)
- **iWork files:** Keynote (key), Pages (pages), Numbers (numbers)
- **Audio files:** WAV (wav, wave), MP3 (mp3), OGG (ogg)
- **Archive files:** ZIP (zip), GZIP (gz, gzip), TAR (tar), TAR.GZ (tar.gz, tgz), 7Z (7z), RAR (rar)

This list can be customized by setting `documents_file_types` manually in the editor configuration.

**Type:** `Array`

**Default value:** `undefined`.

The Media Optimizer plugin automatically configures this option when both the `link` plugin and the Media Optimizer plugin are enabled. The automatically configured list includes documents, iWork files, audio files, and archive files.

> **Note:** **Priority Behavior**
> 
> When `documents_file_types` is set, it acts as the source of truth for supported file types throughout the editor. This means:
> 
> - The [Link](../link/) plugin uses this custom list instead of its default supported file types
> - The Media Optimizer plugin also uses this list to determine which `mimeType` values are allowed for file uploads when both the `link` plugin and the Media Optimizer plugin are enabled as they share the same list of supported file types via this option.
> 
> - If a MIME type is blocked by the Uploadcare dashboard on the server side, the MIME type will also be blocked on the client side regardless  of whether `documents_file_types` is set, resulting in an error message such as "File type not allowed" or "File type not supported".
> If `documents_file_types` is not set:
> 
> - The [Link](../link/) plugin uses its default list of supported file types
> - The Media Optimizer plugin uses its own default list of supported file types (as listed above)

#### Example: Using `documents_file_types` with Media Optimizer

This example shows how to customize the file types when using the Media Optimizer plugin with the [Link](../link/) plugin:

```js
tinymce.init({
  selector: 'textarea',
  plugins: 'uploadcare link',
  toolbar: 'link',
  uploadcare_public_key: '<your-public-key>',
  documents_file_types: [
    { mimeType: 'application/msword', extensions: [ 'doc' ] },
    { mimeType: 'application/vnd.ms-excel', extensions: [ 'xls' ] },
    { mimeType: 'application/vnd.ms-powerpoint', extensions: [ 'ppt', 'pps' ] },
    { mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', extensions: [ 'docx' ] },
    { mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', extensions: [ 'xlsx' ] },
    { mimeType: 'application/vnd.openxmlformats-officedocument.presentationml.presentation', extensions: [ 'pptx' ] },
    { mimeType: 'application/pdf', extensions: [ 'pdf' ] },
    { mimeType: 'application/rtf', extensions: [ 'rtf' ] },
    { mimeType: 'text/plain', extensions: [ 'txt' ] },
    { mimeType: 'application/vnd.apple.keynote', extensions: [ 'key' ] },
    { mimeType: 'application/vnd.apple.pages', extensions: [ 'pages' ] },
    { mimeType: 'application/vnd.apple.numbers', extensions: [ 'numbers' ] },
    { mimeType: 'audio/wav', extensions: [ 'wav', 'wave' ] },
    { mimeType: 'audio/mpeg', extensions: [ 'mp3' ] },
    { mimeType: 'audio/ogg', extensions: [ 'ogg' ] },
    { mimeType: 'application/zip', extensions: [ 'zip' ] },
    { mimeType: 'application/gzip', extensions: [ 'gz', 'gzip' ] },
    { mimeType: 'application/x-tar', extensions: [ 'tar' ] },
    { mimeType: 'application/x-gtar', extensions: [ 'tar.gz', 'tgz' ] },
    { mimeType: 'application/x-compressed-tar', extensions: [ 'tar.gz', 'tgz' ] },
    { mimeType: 'application/x-7z-compressed', extensions: [ '7z' ] },
    { mimeType: 'application/vnd.rar', extensions: [ 'rar' ] }
  ]
});
```
This option is part of the [Link plugin](../link/) and can also be configured independently. For more information about file upload configuration, see [`documents_file_types`](../link/#documents-file-types) in the Link plugin documentation.

## Toolbar buttons

The Media Optimizer’s Files and Documents feature plugin provides the following toolbar buttons:

| Identifier | Description |
| --- | --- |
| `link` | Opens the Insert/edit link dialog so the user can upload files via file picker or by dropping files to be uploaded. Uploaded files are processed through Uploadcare’s infrastructure and automatically linked in the content. |

These toolbar buttons can be added to the editor using:

- The [`toolbar`](../toolbar-configuration-options/#toolbar) configuration option.
- The [`quickbars_insert_toolbar`](../quickbars/#quickbars_insert_toolbar) configuration option.
- [Custom Context toolbars](../contexttoolbar/).

## Menu items

The Media Optimizer’s Files and Documents feature plugin provides the following menu items:

| Identifier | Description |
| --- | --- |
| `link` | Opens the Insert/edit link dialog so the user can upload files via file picker or by dropping files to be uploaded. Uploaded files are processed through Uploadcare’s infrastructure and automatically linked in the content. |

These menu items can be added to the editor using:

- The [`menu`](../menus-configuration-options/#menu) configuration option.
- The [`contextmenu`](../menus-configuration-options/#contextmenu) configuration option.
- [Custom Menu toolbar buttons](../custom-menu-toolbar-button/).
