A Small History
CKEditor has been one of the most popular and used WYSIWYG editor for web, which has been used by many popular open source projects, websites and companies. According to its official website, FCKeditor has been around for more than six years. Since 2003 it has built a strong user community becoming the most used editor in the market, accumulating more than 3,5 million downloads. On 2009, the company decided renaming the editor, bringing to the light their next generation solution: CKEditor 3.0.
CKEditor inherits the quality and strong features people were used to find in FCKeditor, in a much more modern product, added by dozens of new benefits, like accessibility and ultimate performance.CKEditor has made many features pluggable so that it can be extended by developers according to their needs.
Why this tutorial?
However, the new CKEditor does not provide the File Manager/File Browser that it used to provide by default in FCKEditor. This functionality is now provided by CKFinder. CKFinder provides many cool functions and is definitely a better product than traditional FCKEditor’s FIle Browser, but its not a free product and users have to purchase the license in order to use the product.
If you are not willing to purchase CKFinder you can make your own external file manager and plugin to CKEditor through its APIs, alternatively you can directly integrate the FCKEditor’s File Manager (File Browser) feature with CKEditor. This is what i am going to describe in this short tutorial.
Before starting the tutorial you may also like to view the fully functional demo, or you may download the example and start working on it. Please note that this tutorial is for the PHP language and connectors, but same steps can also be applied for other supported languages and connectors.
Also I assume that you have sufficient knowledge about integrating CKEditor on your page.
Starting with the tutorial
Download the CKEditor and copy it to your desired folder. In this example I have copied it to
siteroot/filemanager_in_ckeditor/js/ckeditor
demo.html is the page where I would like to add the WYSIWYG editor, and I have placed my page over here:
siteroot/filemanager_in_ckeditor/demo.html
Since we are going to integrate the inbuilt File Manager available in FCKEditor we will copy the ‘filemanager’ folder from the FCKEditor source files which is genereally located in
fckeditor/editor/
In this example I have copied the ‘filemanager’ folder to
siteroot/filemanager_in_ckeditor/js/ckeditor/
At this stage you may delete the connectors from the filemanager folder which you are not using. I have deleted all the connector folders except the ‘php’ connector which I am using in this example.
Once the required files are copied you need to tie up the filemanager with CKEditor and make it active in the code. To do this you need to modify the CKEditor intialization code like below. (Obviously this goes in demo.html page in my case)
CKEDITOR.replace( 'editor1', { filebrowserBrowseUrl :'js/ckeditor/filemanager/browser/default/browser.html?Connector=http://www.mixedwaves.com/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/connector.php', filebrowserImageBrowseUrl : 'js/ckeditor/filemanager/browser/default/browser.html?Type=Image&Connector=http://www.mixedwaves.com/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/connector.php', filebrowserFlashBrowseUrl :'js/ckeditor/filemanager/browser/default/browser.html?Type=Flash&Connector=http://www.mixedwaves.com/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/connector.php'} );
The above options, enables the “Browse Server” buttons on the “Link”, “Image”, “Flash” dialogs. You will have to adjust the above paths according to your directory structure. Also please note that for the sake of simplicity I have hard coded my website domain (www.mixedwaves.com) in the above paths, this should be changed to whatever is applicable in your case and can be added dynamically instead of hard coding it.
One important thing to remember at this stage is that while integrating the File Browser in CKEditor we still have to make configuration changes that we used to do for enabling the Browse and Upload functions in FCKEditor. Like enabling the php connector and specifying the UserFilesPath to correct location in:
filemanager/connectors/php/config.php
Up to now if everything has gone correct, you should be able to see the “Browse Server” buttons in the “Link”, “Image” and “Flash” dialogs. Clicking on the “Browse Server” button would open the “File Manager” window.
As a last step to making everything work you need to modify the following file:
filemanager/browser/default/frmresourcelist.html
You need to add the following JavaScript function, where all the other Javascript functions have been defined. Copy and paste the below code:
function GetUrlParam( paramName ) { var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ; var oMatch = oRegex.exec( window.top.location.search ) ; if ( oMatch && oMatch.length > 1 ) return decodeURIComponent( oMatch[1] ) ; else return '' ; }
In the same file you need to modify the function called “OpenFile”. Search the function “OpenFile” and replace it with the following function:
Update: 25 June 2011
File names with spaces are now visible in preview window. Earlier filenames with spaces were not encoded correctly hence were not visible in preview window. Thanks to Angela Yamat and Len
function OpenFile( fileUrl ) { //PATCH: Using CKEditors API we set the file in preview window. funcNum = GetUrlParam('CKEditorFuncNum') ; //fixed the issue: images are not displayed in preview window when filename contain spaces due encodeURI encoding already encoded fileUrl window.top.opener.CKEDITOR.tools.callFunction( funcNum, fileUrl); /////////////////////////////////// window.top.close() ; window.top.opener.focus() ; }
The above code essentially sets the file URL to the preview window in the dialog box, when user selects a file in the File Manager.
With this you are done integrating the File Manager in CKEditor.
If everything has been configured and patched correctly, you should now be able to use a fully functional File Browser window just like you used to do in old FCKEditor.
Update: 3rd April 2010
With the generous effort of Brombomb, you can now also enable the ‘Upload’ tab for quick upload of files in your File Browser. You can find the hack on this link: http://stackoverflow.com/questions/1903510/ckeditor-integration-with-fckeditor-filebrowser/2564039
I have also implemented the above solution but with few modifications and in more systematic way so that the functionality is as close as possible with the old FCKEditor file browser. Thanks again to Brombomb.
Continuing with the tutorial, Enabling Quick Upload
Once you are done with the above steps you will have fairly working File Browser Window. However the old FCKEditor also supported a feature called Quick Upload and had separate upload tab. The upload tab can be enabled and made functional by following the below four steps.
In your CKEditor initialization code you need to add few more config variables as shown below that enables the Quick Upload tab. (Again this goes in demo.html page)
CKEDITOR.replace( 'editor1', { filebrowserBrowseUrl :'js/ckeditor/filemanager/browser/default/browser.html?Connector=http://www.mixedwaves.com/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/connector.php', filebrowserImageBrowseUrl : 'js/ckeditor/filemanager/browser/default/browser.html?Type=Image&Connector=http://www.mixedwaves.com/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/connector.php', filebrowserFlashBrowseUrl :'js/ckeditor/filemanager/browser/default/browser.html?Type=Flash&Connector=http://www.mixedwaves.com/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/connector.php', filebrowserUploadUrl :'http://www.mixedwaves.com/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/upload.php?Type=File', filebrowserImageUploadUrl : 'http://www.mixedwaves.com/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/upload.php?Type=Image', filebrowserFlashUploadUrl : 'http://www.mixedwaves.com/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/upload.php?Type=Flash' });
Again need not mention, that the domain needs to be replaced by your own domain. The last three config variables in the above code enables the “Upload” tab in your “Flash”, “Image”, “File” dialogs. Same can be done for “Media” type which I haven’t done in this tutorial.
Now in next few steps we are going to modify/hack few files, this needs little care and attention.
Open the the file
filemanager/connectors/php/upload.php
And search and replace the PHP function call “FileUpload” with the following code snippet
// Get the CKEditor Callback $CKEcallback = $_GET['CKEditorFuncNum']; //pass it on to file upload function FileUpload( $sType, $sCurrentFolder, $sCommand, $CKEcallback );
Now open the below file and search for the function definition “FileUpload”.
filemanager/connectors/php/commands.php
Here we are going to add a new parameter to the function parameter list, as well as some modification in the body of the function. I would recommend you to replace the entire function definition with the following new function definition
// Notice the last paramter added to pass the CKEditor callback function function FileUpload( $resourceType, $currentFolder, $sCommand, $CKEcallback = '' ) { if (!isset($_FILES)) { global $_FILES; } $sErrorNumber = '0' ; $sFileName = '' ; //PATCH to detect a quick file upload. if (( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) ) || (isset( $_FILES['upload'] ) && !is_null( $_FILES['upload']['tmp_name'] ) )) { global $Config ; //PATCH to detect a quick file upload. $oFile = isset($_FILES['NewFile']) ? $_FILES['NewFile'] : $_FILES['upload']; // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ) ; // Get the uploaded file name. $sFileName = $oFile['name'] ; $sFileName = SanitizeFileName( $sFileName ) ; $sOriginalFileName = $sFileName ; // Get the extension. $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ; $sExtension = strtolower( $sExtension ) ; if ( isset( $Config['SecureImageUploads'] ) ) { if ( ( $isImageValid = IsImageValid( $oFile['tmp_name'], $sExtension ) ) === false ) { $sErrorNumber = '202' ; } } if ( isset( $Config['HtmlExtensions'] ) ) { if ( !IsHtmlExtension( $sExtension, $Config['HtmlExtensions'] ) && ( $detectHtml = DetectHtml( $oFile['tmp_name'] ) ) === true ) { $sErrorNumber = '202' ; } } // Check if it is an allowed extension. if ( !$sErrorNumber && IsAllowedExt( $sExtension, $resourceType ) ) { $iCounter = 0 ; while ( true ) { $sFilePath = $sServerDir . $sFileName ; if ( is_file( $sFilePath ) ) { $iCounter++ ; $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; $sErrorNumber = '201' ; } else { move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; if ( is_file( $sFilePath ) ) { if ( isset( $Config['ChmodOnUpload'] ) && !$Config['ChmodOnUpload'] ) { break ; } $permissions = 0777; if ( isset( $Config['ChmodOnUpload'] ) && $Config['ChmodOnUpload'] ) { $permissions = $Config['ChmodOnUpload'] ; } $oldumask = umask(0) ; chmod( $sFilePath, $permissions ) ; umask( $oldumask ) ; } break ; } } if ( file_exists( $sFilePath ) ) { //previous checks failed, try once again if ( isset( $isImageValid ) && $isImageValid === -1 && IsImageValid( $sFilePath, $sExtension ) === false ) { @unlink( $sFilePath ) ; $sErrorNumber = '202' ; } else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml( $sFilePath ) === true ) { @unlink( $sFilePath ) ; $sErrorNumber = '202' ; } } } else $sErrorNumber = '202' ; } else $sErrorNumber = '202' ; $sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder ) ; $sFileUrl = CombinePaths( $sFileUrl, $sFileName ) ; if($CKEcallback == '') { SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ) ; } else { //issue the CKEditor Callback SendCKEditorResults ($sErrorNumber, $CKEcallback, $sFileUrl, $sFileName); } exit ; }
As a final step, we are going to modify the below file and add a new function towards the end of the file
filemanager/connectors/php/io.php
Add the below function towards the end of the file
// This is the function that sends the results of the uploading process to CKEditor. function SendCKEditorResults ($errorNumber, $CKECallback, $fileUrl, $fileName, $customMsg ='') { // Minified version of the document.domain automatic fix script (#1919). // The original script can be found at _dev/domain_fix_template.js echo <<<EOF <script type="text/javascript"> (function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})(); EOF; if ($errorNumber && $errorNumber != 201) { $fileUrl = ""; $fileName= ""; } $msg = ""; switch ($errorNumber ) { case 0 : $msg = "Upload successful"; break; case 1 : // Custom error. $msg = $customMsg; break ; case 201 : $msg = 'A file with the same name is already available. The uploaded file has been renamed to "' . $fileName . '"' ; break ; case 202 : $msg = 'Invalid file' ; break ; default : $msg = 'Error on file upload. Error number: ' + $errorNumber ; break ; } $rpl = array( '\\' => '\\\\', '"' => '\\"' ) ; echo 'window.parent.CKEDITOR.tools.callFunction("'. $CKECallback. '","'. strtr($fileUrl, $rpl). '", "'. strtr( $msg, $rpl). '");' ; echo '</script>'; }
The above function essentially sends back the result of the upload to the preview window. It will alert if something wrong has happened like uploaded an invalid file.
With this we are done with integrating a full featured File Browser in CKEditor.
I hope this tutorial is useful to you. Please post your doubts or questions you may have and I would be happy to respond to it.
PS. I have taken utmost care to place the above code snippets correctly, however my WYSIWYG editor seems to change the PHP and JS code undesirably. If you find any errors/typos in the above code snippets you can check the actual source code files; it would be really great if you can bring it to my notice so that I can correct it and also help you out if possible.
Thx mate, great job!
Excellent! Thanks a ton for this. Saved me from attempting to write my own plugin.
Hi I’ve installed the demo download version, everything works except when I go to the file browers through Ckeditor I get the dialog box pop up saying
“Ther server didn’t reply with the proper XML data, please check your configuration.”
I’ve checked the config.php file in filemanagers/connectors and enter in the absolute path, c:\\dir\dir\userfiles\\
? Where am I going wrong?
Hi Linze,
The above problem generally arises due to incorrect path to the directory where the file uploads. Please make sure you have the correct path. I think setting only the ‘UserFilesPath’ is enough and setting ‘UserFilesAbsolutePath’ is not required.
Also if you are using FF, try to debug it with Firebug. The response received from the Ajax request when the Filebrowser window loads will give you more info, or paste the response here and I can check whats exactly wrong.
Thats Great!
)
Thank you very match.
Hi, this is the best tutorial I see in the NET about this theme, is great. Thanks.
Have just one thing I don’t understand, what is the folder that will contain the images or files?
I have to create a folder, if yes what I have to change?
Gloradin, glad you liked it and was useful to you.
Files can be stored in any folder you like relative to your site document root. You can specify the path you want to store your files to in:
‘/ckeditor/filemanager/connectors/php/config.php’
Set your path in config variable $Config['UserFilesPath'] relative to your site document root.
eg.
$Config['UserFilesPath'] = ‘/userfiles/’
The filebrowser automatically creates folder for each media type ‘Image’, ‘Flash’, ‘Media’ at the location you have specified above.
Hi thanks for you help! I had another look and realised that I hadn’t referenced the connector.php file correctly when initialising the editor.
I’ve now included the file references as a php variable so I can’t break it!!
thanks, Awesome tutorial.
Hi again!
Id there any way I can just upload files like PDFs or word documents via the filemanager?
Great Job! Excellent!
I was despairing the last houres before I found this site.
Thanks a lot!
Thank you very much! I wasn’t keen to purchase the CKFinder just yet, and this is a great alternative.
@Linze: yes you can upload files like PDF, DOC with File Type (not Image, Flash, Media). File Type is assumed when you do not specify any ‘Type’ variable in the ckeditor config variable ‘filebrowserBrowseUrl’
Also, you can upload files when you click on the ‘Link’ button on the toolbar and browse server.
Hope this helps.
Hi,
Thank you for a great work!
I’m having some strange problems.
- When I try to create a folder, the error say:
Unknown error creating folder
- No error when uploading images but the images does not get stored on server.
The folder “UserFiles” as chmod 777
as do the created image and flash folders.
My settings:
$Config['UserFilesPath'] = ‘/diggibyte.se/testsite/diggisite/UserFiles/’ ;
$Config['UserFilesAbsolutePath'] = ‘/hsphere/local/home/deffedefect/diggibyte.se/testsite/diggisite/UserFiles/’ ;
Browsing dir:
[DIR] Parent Directory 18-Mar-2010 23:47 –
[DIR] flash/ 19-Mar-2010 00:31 –
[DIR] image/ 19-Mar-2010 00:28 –
I’m running on Apache server and using PHP5
Best regards,
Deffe
Hi again…
More info:
I’m using
CKEditor 3.2 (revision 5205)
When playing with UserFiles folder path I recived:
http://i182.photobucket.com/albums/x197/DeffeDefect/Blandat/error.jpg
I’ll try your version with CKEditor 3.1
Best regards,
Deffe
Thanks
@Deffe: From the screen shot it appears the problem due to your server settings. Safe Mode is enabled. I think if you keep your UserFilesPath under your Site document root the problem might get solved. Ownership can also be an issue. When safe_mode is on, PHP checks to see if the owner of the current script matches the owner of the file to be operated on by a file function or its directory.
Hi
First thank you for this great tutorial. I searched a couple of hours for a filemanager so great solution you got here.
But I have one problem. I see the file browser button in ckeditor and I get the page for selecting an image. But when I click on the image, nothing happens. The page doesn’t disappear and the link is not passed through.
Thanx
Hi Penuel,
You are correct! My hosting provider have Safe Mode enabled and don’t want to turn if off (probably waiting for PHP6). Do you have a solution to this problem beside getting a new provider..?
Best regards,
Detlef Andersson
Jeroen, thanks for your comments. From what you have described in your problem, it appears you didn’t follow the tutorial correctly towards the end.
I would like you to double check the changes that you need to make in this file:
filemanager/browser/default/frmresourcelist.html
Please make sure you have patched the code in this file correctly or else you may also copy & replace the above file from the download link I have given in the above tutorial.
Please let me know if that solves your problem.
Detlef, from here I can think of one solution that might work, though i am not sure.
Try creating the ‘image’ folder using any FTP program and give correct permissions. I think the php script doesn’t have sufficient privileges to create the folder due to safe_mode in effect. The problem is due to the ownership of folder and safe_mode.
Penuel, I copy pasted your code in the frmresourcelist.html and now the problem is solved. My mistake.
Again thank you. This tut helps me enormously!
May I post a link to this tut in a Belgium php forum?
@Jeroen thanks for your comments and please feel free to refer this tutorial on other blogs and forums.
hi
thanks for all this. works very well.
is there any chance to delete files again, once they are uploaded?
Martin, thanks for your comments. There is no delete function provided to remove uploaded files, but I think its pretty simple to add if you have knowledge of PHP or similar scripting languages.
Hi there,
I’m having some problems with the size of uploded files actualy. It seems that you cannot upload files bigger than 1mo using filemanager.
Is there a way to fix that?
Thanks!
I found the solution myself.
I needed to edit my php.ini file to allow bigger file uploads.
@Pierre, alternatively if .htaccess file is allowed on your site/host, you may also set the values of upload_max_filesize, post_max_size in .htaccess file instead of php.ini file.
Penuel,
Thanks for all your help. Saved me a lot of time. I’m a little stuck on the uploading functionality. I can upload from the file manager but it never refreshed itself. I have also been working on the “quick upload” tab from the other version but it won’t upload. Have you run into this or have any ideas about fixing it?
For the quick upload I think its expecting a javascript callback of
window.parent.CKEDITOR.tools.callFunction($funcNum, ‘$url’, ‘$message’)
which I rewrote in the IO file to support but it’s not catching.
I got it! I posted my solution over at the place I found this:
http://stackoverflow.com/questions/1903510/ckeditor-integration-with-fckeditor-filebrowser/2564039#2564039
@brombomb, you have made this a complete solution
Thanks for your efforts and posting it here. I have updated my tutorial to link to your post as well as I have done few modifications to your hacks so that its more systematic and nearer to FCKEditor’s file upload functions.
Thanks again for your great help!
Hello, and thanx alot, but i have a problem, i would like to know where to know :
CKEDITOR.replace( ‘editor1′,
{
filebrowserBrowseUrl :’js/ckeditor/filemanager/browser/default/browser.html?Connector=http://www.mixedwaves.com/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/connector.php’,
filebrowserImageBrowseUrl : ‘js/ckeditor/filemanager/browser/default/browser.html?Type=Image&Connector=http://www.mixedwaves.com/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/connector.php’,
filebrowserFlashBrowseUrl :’js/ckeditor/filemanager/browser/default/browser.html?Type=Flash&Connector=http://www.mixedwaves.com/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/connector.php’}
);
this code, where i have to put, in which file, i see that all of u know where to put, i need to know quickly, and thanx again
@Ahmed put your initialization code to the page where you want to show your editor. In my example i have placed in demo.html where I display my editor. Hope this helps.
yahhooo, it is working , thanx alot Penuel, and really u r intellegent.
Great Work!
Hi, this is a really cool patch, thanks so much!
I’m having the same problem as Linze, getting the “The server didn’t reply with the proper XML data, please check your configuration.” message.
If I reference connector.php locally like this: ckeditor/filemanager/connectors/php/connector.php, then the browser will show up, but I get the above message.
But if I reference connector.php by the absolute path like this: http://www.supertracks.co.uk/karaoke-site/editor/ckeditor/filemanager/connectors/php/connector.php I get the following message:
Forbidden
You don’t have permission to access /karaoke-site/editor/ckeditor/filemanager/browser/default/browser.html on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
I checked and double-checked and double-double-checked again and the path is correct, so I can’t figure out what is stopping me.
If anyone gould throw me a clue, I’d be most grateful
When I implement this, It uploads the file correctly no matter what I do, but I am having issues with the “Browse Server” button.
It seems when you click the Upload tab and upload a image, it uploads it to the /userfiles/ folder that I specified in …/filemanager/connectors/php/config.php as the
$Config['UserFilesPath'] = ‘/userfiles/’ ;
But when I click “Browse Server” Button and upload it from there, it creates a dir in /userfiles/ called /image/ and uploads it there.
I guess I need to set the url path of the “Send it to Server” option under the “Upload” tab but I have no idea on how to.
Please help…
Also when you click the “Browse Server” button, you can only see the images in the /userfiles/images/ folder.
Also, does anybody know how to set it to create a folder dependent on who uploads the item?
i.e. say I upload an image called “picture.gif using my screen name of “1weird1″, it creates a folder in /userfiles/ called /userfiles/1weird1/images/picture.gif
while say “JowBlow” uploads a file called “pictureofme.gif” it creates and uploads this as /userfiles/JoeBlow/images/pictureofme.gif
and either ones of us can only see what is in our own folder.
Understand what I am saying?
@Lee its difficult to guess but the improper xml error generally arises when you have not set the paths correctly in editor initialization or the config.php file in the connectors folder.. You may also use firebug and check the ajax response to get the exact problem.
@1weird1 answering your first question for the Upload Tab you need to set the paths in the QuickUpload Config variables in your config.php (
$Config['QuickUploadPath']['File'], $Config['QuickUploadPath']['Image'], $Config['QuickUploadPath']['Flash'].
See the comment by the author in this file about exactly how you can set the paths.
With your second question, you will need to hack the code further to meet your requirements it should be pretty simple using Sessions.
@Penuel
Thanks buddy. I tried firebug on it and if I run the local path in the initialization code, firebug points to that as the problem, but if I change that and input the absolute path, there is nothing for firebug to check, because I end up at a 403/404.
The only path I can find in connector.php is this: if ( !$Config['Enabled'] )
SendError( 1, ‘This connector is disabled. Please check the “editor/filemanager/connectors/php/config.php” file’ ) ; but this only seems to be a message if it is disbaled.
@Lee, you need to set paths in config.php not connector.php.
@Penuel. Yea it was in the config.php file as something different…
Changed $Config['QuickUploadPath']['Image']=$Config['UserFilesPath'] ;
TO
$Config['QuickUploadPath']['Image']=$Config['UserFilesPath'] . ‘image/’ ; and so on and it worked. But to the other part, I tried to hack it a little, but I am so confused…. Maybe someone can help me. I figure it can probly write a php function to capture the name and in the config.php file you would have the $Config['UserFilesPath']=’/userfiles/’; to something like $Config['UserFilesPath']=’/userfiles/$user/’; or something like that, but everything I try either crashes ckeditor, or just simply doesn’t work. Got any ideas I can expand on?
Doh! it was late lol.
In config.php I have this: $Config['UserFilesPath'] = ‘/karaoke-site/images/uploads/’;
$Config['UserFilesAbsolutePath'] = ‘http://www.supertracks.co.uk/karaoke-site/images/uploads/’;
Thes just need to pint to the upload directory right?
Thanks again.
Just to add, this is the url I get (without the ”) when clicking browse server. It looks right to me when comparing it with the url in the demo.
‘http://www.supertracks.co.uk/karaoke-site/editor/ckeditor/filemanager/browser/default/browser.html?Type=Image&Connector=http://www.supertracks.co.uk/karaoke-site/editor/ckeditor/filemanager/connectors/php/connector.php&CKEditor=editbody&CKEditorFuncNum=2&langCode=en-gb’
@Lee, please keep this $Config['UserFilesAbsolutePath'] as default (empty). What you have set is incorrect.
@1weird1 what you have done appears to be correct, and since the path can be set to any directories (either hardcoded of dynamicly generated paths using Username values in your case), just you need to make sure that the directory actually exists. Are you creating the directories before the code references it ??
In the past i have seen somewhere in connector code, where it uses mkdir() to create directories if they don’t exist. May be you can modify that part to include your requirements and paths.. Hope this helps.
Ok, I emptied the value for Config['UserFilesAbsolutePath'], but still the problem exists. No matter what I do with the initialization urls, I just can’t make it work.
This is my initialization code and my config code, I put the relevant bits in this txt file.
http://www.supertracks.co.uk/karaoke-site/mycode.txt
Sorry to bug you with this, if you got a donate button somewhere, I’ll happily use it, cos this script is really going to be a cherry on the top of my first ever php app.
I am so confused, i just don’t know. I see the function in /filemanager/connectors/php/io.php/ file that creates the directory, but I have yet to find the page that calls for that function so I can have it make a dir automatically.
I am to the point of giving up on this.
I am simply not advanced enough in php to figure this out i guess.
Hi there, Thank you so much for your great work.
I am facing a small problem, Everything is working fine, but when I am uploading the images from (Browse Server/Image Uplaod) and normal Upload (Send it to server), both images are going to different folder.
But when you come back and do browse server, it will only show you images from one folder that is your “configured directory/images”.
Can you please help me on this, Thanks a ton.
@sujeet, please see my answer to @1weird1.
For the Upload Tab (send it to server) you need to set the paths in the QuickUpload Config variables in your config.php
$Config['QuickUploadPath']['File'], $Config['QuickUploadPath']['Image'], $Config['QuickUploadPath']['Flash'].
See the comment by the author in this file about exactly how you can set the paths.
Hope this helps