phpeditorwysiwygcodeigniter-4jodit

How to integrate image upload option in jodit editor


I am trying to integrate Jodit edit in my Codeigniter 4 project,

I have this Js code:

<script type="text/javascript">
    $('textarea').each(function() {
        var editor = new Jodit(this, {
            uploader: {
                url: 'public/connector/upload.php?action=fileUpload'
            },
            filebrowser: {
                ajax: {
                    url: 'public/connector/upload.php'
                }
            }
        });
        editor.value = '<p>start</p>';
    });
</script>

But I am not getting a good result, I can't upload, I can't access the elfinder,

enter image description here

Please help.


Solution

  • I think the problem is your setting jOedit

    filebrowser: {
                    ajax: {
                        url: 'public/connector/upload.php'
                    }
                }
    

    Remplace it with :

    filebrowser: {
                    ajax: {
                        url: <?php print base_url('public/connector/upload.php'); ?>
                    }
                }
    

    And I hope it will work for you!