Install PHP file manager for TinyMCE 5 and 4

After you installed N1ED which gives you a simple way to load the file manager plugin (and also image editor and widgets add-ons that also use server storage) you need to add server support for manipulations with files.

Note. You can also use 3rd party file manager and this is supported. But due to Flmngr offers more features, some tools and widgets like Galleries will be unavailable with 3rd party file managers.

Install file manager package to your server

There are two ways: placing PHP files inside your project or using Composer if your project uses it. Choose the way and use according to instructions below.

Way 1. Installing by manual copying PHP files

If you want to install Flmngr without using Composer, simply download the latest version of PHP version of Flmngr, then unpack it to some folder on the website and set Flmngr.urlFileManager and Flmngr.urlFiles according to server files location.

This way is only recommended for CMS that do not work with Composer. Otherwise, we recommend using the modern way to install the package.

Way 2. Installing using Composer

To install File Manager for PHP in modern way, you need to download the Composer-module edsdk/flmngr-server-php for it and link it to your current project or website.

To install the package, use this console command:

composer require edsdk/flmngr-server-php

After that, in your code that processes the request to the URL you pass to File Manager, add the following call somewhere in your project where you want to place the entry point for File Manager:

use EdSDK\FlmngrServer\FlmngrServer;

FlmngrServer::flmngrRequest(
    array(
        'dirFiles' => '/var/www/files',
        'dirCache' => '/var/www/files/cache',
        'dirTmp'   => '/var/www/files/tmp'
    )
);

You can learn more about installing the package on the Flmngr for PHP module page.

Configure the server-side of the file manager

Find the place where you call the file manager. If you copied PHP files manually it is located in flmngr.php file. If you use Composer, find the place where you call flmngrRequest (from the sample above).

As you can see there are three paths you need to configure:

dirFiles - the place where you store all the files and images which are browsed by Flmngr file manager. You can use your existing storage you had before N1ED installation and Flmngr file manager will work like a charm with it.

dirCache and dirTmp directories can be located anywhere and do not need to be publicly accessed from the web at all. Just be sure they exist.

It is recommended to use absolute paths for all directories to avoid mistakes.

Check also the access rights for all these directories: system user used for your application or website must have both read and write right to them. For example in Ubuntu this used is called www-data, in other Linux distributions there can be other names for it i. e. apache or some custom user.

Link TinyMCE 5 and 4 with file manager server-side

Now it's time to tell TinyMCE 5 and 4 to use the file manager you installed on the server.

  1. Enable Flmngr in your configuration (enabled by default).

  2. Find the plugin "File Uploader" inside the configuration window and press "Configure". There are paths you are to configure there:

File Manager URL - Set the URL on which your Flmngr backend is linked to. This depends on how you installed your backend in the previous steps. N1ED will call this URL to ask your server about something (list files, upload a file, etc.). For PHP installation in probably should contain the full URL of flmngr.php file. Please use the absolute link (with protocol and domain) to avoid mistakes.

Files URL - Specify the prefix of URL where your files and images are available through the web. For example, if you have URL of some published image like https://example.com/images/demo.png, probably the correct Files URL will be https://example.com/images. This parameter depends on dirFiles parameter you specified on the server. The difference is server configuration explains where to store files on disc, and this client configuration explains how to access files from web.

Uploads directory - The directory which will store uploaded files without a parent directory specified (quick uploads). The path starts from the root of your files stored on the server. For example you store files in /var/www/images and want to store all quick uploads in /var/www/images/uploads, the correct value here will be /uploads/ (be sure this directory exists on the server). Keep the default / value to set root storage directory as default storage directory.