Jan
22
CKEditor, enable the image or flash upload
January 22, 2010 | 1 Comment
CKEditor is a greatly improved version of the famous FCKEditor. The generated source code is clean and well indented, the whole thing loads faster and feels less buggy. It even looks better.
What I really like though, is the new settings that allow for precise definition of what we want to encode or not and how we wish to handled pasted code (expecially coming from Word processors)
CKeditor is a rather recent version and some documentation will surely arrive soon, in the meantime, the file upload isn’t very documented.
Nevertheless, with some Stack Overflow help, it all comes together pretty quickly :
- enable the file upload in the configuration by adding the following to your configuration file
1 | config.filebrowserUploadUrl = '/fckupload'; |
- Code your upload method that will be called when the URL defined in the configuration is called upon
- Then, that’s the undocumented part, in JavaScript, call method required by CKEditor which is sent to you in the URL (below is a PHP example)
1 2 3 4 5 | private function upload() { // do upload // get file Url echo '<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction('.$this->getHttpParam("CKEditorFuncNum").', "'.$fileUrl.'");</script>'; } |
Comments
1 Comment so far
New blog post: CKEditor, enable the image or flash upload: CKEditor is a greatly improved version of the famous FC… http://bit.ly/4oFX2W