How to add CKEditor with image upload using KCFinder in PHP Example Code?

By Hardik Savani | July 1, 2016 | Category : PHP

We can implement ckeditor with image uploading in PHP simply. if you want to use ckeditor in your PHP project and you also want to add file uploading as well then you can do easily to follow bellow step.

In this example i use ckeditor with KCFinder for image uploading. KCFinder through we can file upload easily using their api. If you don't know about ckeditor and KCFinder then no issue you can add simple way.

Now, i will give you few step to set ckeditor with file uploading and you will easily apply this. this is a very simple to browse your image, file etc upload.


Step 1 : Download CKEditor

In this step we have to download ckeditor from its official website, i mean here : and extract in your root folder.

Step 2 : Download KCFinder

In this step we have to download ckeditor from its official website, i mean here : and extract in your root folder. Also change folder name just "kcfinder".

Step 3 : Configuration

In this step we have to add Configuration for file uploading, so just open config.js in ckeditor and put bellow code:


CKEDITOR.editorConfig = function(config) {

config.filebrowserBrowseUrl = '/kcfinder/browse.php?opener=ckeditor&type=files';

config.filebrowserImageBrowseUrl = '/kcfinder/browse.php?opener=ckeditor&type=images';

config.filebrowserFlashBrowseUrl = '/kcfinder/browse.php?opener=ckeditor&type=flash';

config.filebrowserUploadUrl = '/kcfinder/upload.php?opener=ckeditor&type=files';

config.filebrowserImageUploadUrl = '/kcfinder/upload.php?opener=ckeditor&type=images';

config.filebrowserFlashUploadUrl = '/kcfinder/upload.php?opener=ckeditor&type=flash';


Step 4 : Index File

This is last step, you have to create index.php file and put bellow code. If you you find error like "You don't have permissions to upload files" then follow this link : Click Here.




<title>PHP - CKEditor with Image upload</title>

<script src=""></script>

<script src="/ckeditor/ckeditor.js"></script>



<textarea id="editor1" class="ckeditor"></textarea>

<script type="text/javascript">

CKEDITOR.replace( 'editor1' );




Try this....

Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: