Can you browse and upload files in another directory outside of the document root? I want to browse and upload images on a separate web site but all the files are on the same server. Basically a mini CMS on an admin site loading content to a DB and images/files to directories on the public web site. I have tried many things and cannot seem to determine if its possible.
Re: Browse/Upload files not in DocRoot?
They way the editor is set up, by default files are browsed/uploaded based on the directory in your filebrowser connector (php in my case) configuration setting for UserFilePath. For whatever reason that completely escapes me, you cannot override that setting with a simple config call like you can other settings. It's just not part of the allowed variables to be adjusted on the fly. (NOTE: Frederico, it should be and you should allow developers to do a $oFCKeditor->Config['UserFilePath'] = '/path/to/new/dir/'; in their code for CKeditor!!!) Ok, RANT off.
So how then do you get around this? The solution is to use your own custom browser and image uploader. The easiest way to do that is to duplicate the filemanager directory, change the configuration options that need changing, and tell the editor to look in the new location for the connector for THAT instance of the editor. For my purposes, I dupliated the filemanager directory and put it in a separate /lib directory (in my cace I need to do this several times for hosting reasons). the php connector config file points UserFilePath to a different location that I need. Now, in my editor instance, I do the following:
This allows me to use a single instance of the FCKeditor itself, but customize where I need to with minimal file use. Pay special attention to the 'Type=' part, the docs on here are out of date and don't mention the Type parameter. Also note the I created a custom toolbar for this editor instance which you don't have to have. But this way I don't need code to handle all media types, just the ones that concern me.
Also, in the filemanager directory, I only have the connector code i Need (in this case, just the PHP code). I deleted all the asp, and js, and such.
Now in '/lib/filemanger/connectors/php/config.php' I have this set:
I also make sure to change some of the other config paths in that file as suggested in the comments in the file. That way I'm sure everything goes to the proper location whether I use the quickupload or the regular upload. so:
Hope I haven't confused the hell out of you and that you can follow this pretty easily.
Hope this all helps.