Elfinder itegration into TinyMCE4

This solution http://stackoverflow.com/questions/16016870/tinymce-4-with-elfinder did not work for me. I wanted to answer this thread but I don’t have enough reputation.

When you click on “Upload image”:

tinymce-img-upload

Tinymce will show “dialog.php” file in “tinymce/plugins/filemanager/dialog.php” by default. So copy Elfinder folder into “tinymce/plugins/” and rename the folder to “filemanager“. Rename “elfinder.html” to “dialog.php“. And rewrite options in “tinymce/plugins/filemanager/php/connector.php” like this:

$opts = array(
	// 'debug' => true,
	'roots' => array(
		array(
			'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
			'path'          => '../img/',         // path to files (REQUIRED)
			'URL'           => dirname($_SERVER['PHP_SELF']) . '../../img/', // URL to files (REQUIRED)
			'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
		)
	)
);

I changed ‘path‘ and ‘URL‘. It now shows images in “tinymce/plugins/filemanager/img/

I have TinyMCE in my www (root) folder and “uploads” folder too. So in my case I have

'path' => '../../../../uploads/'

and

'URL' => dirname($_SERVER['PHP_SELF']) . '../../../../../uploads/'

It works for me. For you it should work too.
If You have any problem with Elfinder, try this filemanager https://github.com/2b3ez/FileManager4TinyMCE

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s