Uploading Image File in Ckeditor

As in Previous Article I have explained about creating the custom style set when inline css has not been working . You can also create your own style set whenever you want to add some customized classes or other attributes to element in your editor. Now in this article I will help you by explaining the uploading and browsing of Image file in Ckeditor.

To upload Image you have to add ‘filebrowserUploadUrl’ attribute in your editor’s configuration with the defined path where you have written your
code to upload the file.

SCRIPT:

Note: Here  /admin/upload/upload_editor_image is the path of my upload code.

CONTROLLER:

Create a file Upload.php (My file is located under admin folder that’s why i have given the path from there) and create a function  upload_editor_image as below .You can name the function of your own choice :-

MODEL

To upload image functionality you have to upload image into specific folder and return the uploaded file name to controller .

After that , image file from local computer has been uploaded on the server and it will return the path in the url box of dialog . Click on ok and it will insert the uploaded image in your article.

 

This code is written in codeigniter but you can easily use it for core php or in any framework accordingly.

Please follow and like us:
20