📜 ⬆️ ⬇️

CKEditor file manager

In connection with the release of the new version of the popular and highly functional WYSIWYG editor, I had to make a small file manager.

The reason for this was the lack of a default standard file manager, there is of course CKFinder but it is on a paid basis.
Searching for different alternatives, I decided to spend time creating a simple but my own file manager in the manner of CKFinder, which I imagine.
I had to look for how to integrate it with the editor, there is little documentation, but in the end it seemed to work out :)

Features: Uploading multiple files, creating folders, translating downloaded files, renaming, although it's standard to list everything :)
General style in the style of CKFinder in the ACDSee 3 range

Language can be changed in index.html
  1. < script type= "text/javascript" src= "lang/ru.js" > </ script >

')
Screenshot
ckeditor file manager

About the settings:

Connect to <head> </ head>
<br/><script type="text/javascript" src="ckeditor.js"></script><br/><script type="text/javascript" src="ajexFileManager/ajex.js"></script><br/> <br/>


And directly on the page
<br/> < script type= "text/javascript" ><br/> var editor = CKEDITOR.replace( 'editor1' );<br/>ajexFileManager(editor, '/path/to/ckeditor' );<br/> </ script > <br/>


From the basic settings "ajax / cfg.php"
<br/> $cfg [ 'url' ] = 'upload' ; // , <br/> $cfg [ 'root' ] = $_SERVER [ 'DOCUMENT_ROOT' ] . DIR_SEP . $cfg [ 'url' ] . DIR_SEP; // http://www.yousite.com/upload/ <br/> $cfg [ 'quickdir' ] = '' ; // , - , : $cfg['quickdir'] = 'quick-folder'; , /upload/image/quick-folder/filename.jpg <br/> <br/> <br/> $cfg [ 'thumb' ][ 'width' ] = 150 ; // <br/> $cfg [ 'thumb' ][ 'height' ] = 120 ; // <br/> $cfg [ 'thumb' ][ 'quality' ]= 80 ; // <br/> $cfg [ 'thumb' ][ 'cut' ] = true ; // , <br/> $cfg [ 'thumb' ][ 'auto' ] = true ; // ftp , <br/> $cfg [ 'thumb' ][ 'dir' ] = '_thumb' ; // , , <br/> $cfg [ 'thumb' ][ 'date' ] = "jmY, H:i" ; // <br/> <br/> // , <br/> $cfg [ 'chmod' ][ 'file' ] = 0777 ;<br/> $cfg [ 'chmod' ][ 'folder' ] = 0755 ;<br/> <br/>


By itself, not heavy (actually a few text files), images of extensions only take up the volume

Download:
Only the file manager itself (.rar ~ 335Kb)
Fully with CKEditor (.rar ~ 1.1Mb)

The file manager was made for myself, but surely someone else will come in handy. Not devoid of glitches and some functionality, everything gradually over time will do / fix, if the community has interest :)
Subsequent updates will be published here and on my site

P / S: First post, I don’t have karma, so I can’t transfer to “web development” (fixed: thanks for karma, transferred), and didn’t find the syntax highlighting for the code how to do it here (thanks for the advice krig , I thought there is a built-in :)

upd demo

upd
Fixed a couple of problems:
- added a preliminary check for php extensions gd and mbstring
- removed the restriction on downloading files, it turns out there were only graphic files, now you can upload any
- when renaming a file, the old thumbnail was not deleted, and now it is impossible to rename to files without an extension and into invalid formats :)

upd: 0.8.1
- All the same, I decided to put the thumbnails in a separate folder so that the packs of folders are not diluted, the structure will be similar to the original
- Made file sorting
- Added a folder size to the tree
- Slightly changed folder structure
- Made a simple health check, you need to call the php file directly from isWork, for example: ckeditor / ajexFileManager / ajax / php / ajax.php? IsWork
- Well, small things corrected and changed different :)

upd: 0.8.2
- cosmetic changes :)

Archive file manager and ckeditor + connection example
Download Ajex.FileManager 0.8.2 ~ 740 Kb

Source: https://habr.com/ru/post/69838/


All Articles