I am trying to integrate elFinder and TinyMCE using the advanced method found here: https://github.com/Studio-42/elFinder/wiki/Integration-with-TinyMCE-4.x

When I click the image icon in TinyMCE, elFinder will appear in a popup window, and when I double click on a file in elFinder, it should include it in the editor.

However, the following code causes some error I can't figure out.

<script src="//tinymce.cachefly.net/4.2/tinymce.min.js"></script>
<script type="text/javascript">
    selector: "textarea",
    plugins: [
        "advlist autolink lists link image charmap print preview anchor",
        "searchreplace visualblocks code fullscreen",
        "insertdatetime media table contextmenu paste"
    toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
    autosave_ask_before_unload: false,
    file_picker_callback : elFinderBrowser
function elFinderBrowser (field_name, url, type, win) {
    file: '<?=url('/');?>staff/elfinder/',// use an absolute path!
    title: 'elFinder 2.0',
    width: 900,  
    height: 450,
    resizable: 'yes'
  }, {
    oninsert: function (file) {
    // Provide file and text for the link dialog
        if (meta.filetype == 'file') {
//            callback('mypage.html', {text: 'My text'});

        // Provide image and alt text for the image dialog
        if (meta.filetype == 'image') {
//            callback('myimage.jpg', {alt: 'My alt text'});

        // Provide alternative source and posted for the media dialog
        if (meta.filetype == 'media') {
//            callback('movie.mp4', {source2: 'alt.ogg', poster: 'image.jpg'});
  return false;

The error shown in the browser console is ReferenceError: Can't find variable: meta. Can someone help me figure out or troubleshoot this error?

1 Year
Discussion Span
Last Post by Taywin

There is no way to debug from the script. What you need to do is to find where the error occurs (in what line number). You may test your page on Firefox which has Firebug installed. This way, you would see which line that actually causes the error, and then go from there.

PS: You are using meta variable without declaring it from anywhere. Are you sure you are using the variable correctly? meta is NOT a reserved keyword in general for JavaScript.

PSS: The page you provided must be linked from somewhere else. What is the page that links to your page?

Edited by Taywin

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.