TinyMCE Editor Upload Image with PHP & Ajax

TinyMCE is the world’s most popular open source web-based WYSIWYG editor. It has the ability to convert HTML textarea fields or other HTML elements to editor instances. This example demonstrates the integration of upload image in TinyMCE Editor using setup handler with PHP upload functionality. In this tutorial, we will explain you how to use TinyMCE Editor Upload Image with PHP and Ajax.
So let’s implement TinyMCE Editor Upload Image with PHP. look following folder and file structure:
  • tinymce-upload-image-with-php-ajax
    • assets
      • css
        • style.css
      • tinymce.min.js
      • custom.tinymce.js
      • upload
    • templates
      • header.php
      • footer.php
    • index.php
    • upload.php
Step 1: Include jQuery and TinyMCE Plugins
Step 2: Create HTML Form with textarea
In index.php file, we will create a HTML Form with Textarea to load TinyMCE.
Step 3: Initialize TinyMCE Editor
TinyMCE editor can be added to a textarea element with the id tiny-editor using
Step 4: Complete HTML file named index.php
Step 5: Create a file named upload.php
PHP Upload Image Handler
Create header.php and footer.php section of the webpage. The Bootstrap library is used to provide a better UI, so, include it in the header and footer section.
header.php
footer.php