Site Moved

This site has been moved to a new location - Bin-Blog. All new post will appear at the new location.

Bin-Blog

Enabling Image Uploading in FCKEditor for PHP

FCKEditor is one of the most feature rich web based WYSWYG editors. I use it for almost all my projects. However, if you wish to enable image uploading in it, you have to jump through some hoops. This is a small tutorial on how to enable image uploading in FCKEditor. This tutorial is aimed at FCKEditor 2.3.2 - but the principle works in other versions of FCKEditor as well

Configuration

fckconfig.js

Open the file FCKEditor/fckconfig.js

Make sure that the default php connector is selected.

Line : 143 - Approx.

var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | php

By default, the ASP connector is enabled. If any FCKEditor developer is reading this, please make the default connector PHP as it is more commonly used than ASP.

Connector

Open FCKeditor/editor/filemanager/browser/default/connectors/php/config.php

Enable the connector

Line : 24
// SECURITY: You must explicitelly enable this "connector". (Set it to "true").
$Config['Enabled'] = true ;

Make sure that the given 'UserFilesPath' folder exists in the server and has write permission.

$Config['UserFilesPath'] = '/UserFiles/' ;

Uploader

Open file FCKeditor/editor/filemanager/upload/php/config.php

Enable the uploader

Line : 24
// SECURITY: You must explicitelly enable this "uploader". 
$Config['Enabled'] = true ;

All configurations are done.

Test the Editor

Now open up the url : http://www.yoursite.com/FCKeditor/editor/filemanager/browser/default/connectors/test.html in the browser

Select PHP from the 'Connector:' drop down and click the 'Get Folders and Files' link.

If the files and folders of your 'UserFiles' folder is shown in the XML format, all is fine.

9 Comments:

Anonymous said...

It was a very easy to understand tip. Thanks for sharing it on your blog. Have bookmarked it for future reference.

Anonymous said...
This comment has been removed by a blog administrator.
Jesper said...

Is this not a security risk:

www.yourdomain/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/asp/connector.asp

From here everybody can upload without being logged ind to your site????

Anybody know how to secure the filemanager with a password??

Regards Jesper

Binny V A said...

There is a possibility that this system could be used in the way you have described. You can easy protect the folder using Apache's .httaccess security.

Anonymous said...

Thanks Binny you are the man!

Anonymous said...

i m using 2.5.1 release .. but it is not working with file uploader and connector is still disable .

in 2.5.1 , there is no any upload folder .

plz . tell me solutions if u know .


ADnan

Anonymous said...

I followed every step and did so before finding this blog and it still calls the asp connector when browsing ??

Showater said...

i have different users trying to use the fckeditor, and i dont want each one of them to access other ones images, how can i limit it to the images they uploaded only?

brenda said...

When I click on 'Image' button on FCKeditor > get a pop-up box > I fill the 'Image info' details > save it. The image will be showing in textarea of editor. But not actually saving after clicking save button.

Smileys are also not saving. Why? can you please tell me?