given the following directory structure:
/files
--public
----images
------articles
--------12345
--------12346
--------12347 ...etc
/www
--admin
----articles
The datafiles directory is where user-uploaded files are placed - this keeps files that represent data/content from cluttering up the web application code in the www directory. The PUBLIC directory is mapped as a virtual directory, so that it is visible as http://www.example.com/public.
When editing an article, each article has it's own set of images, and that's how we'd like to organize those images... per article. Hence the directory structure under /files.
So, when I'm editing article 12346, I'd like the CKEditor/CKFinder on that form to behave such that when I go to place an image in the article, the directory ONLY points to /files/public/images/articles/12346 -- thats the place where the images would be loaded from, and any uploaded images would go only into that directory.
Is it possible to dynamically set the resource directory for CFEditor/CKFinder, when the form for an article is loaded, so it always looks to the same place? And will I run into a problem with the actual physical file path being outside the webroot where the editors are served from?
Thanks for any help you can provide!
Wed, 10/13/2010 - 17:38
#1
Re: Custom Upload Directory Per Object
Re: Custom Upload Directory Per Object
Hi,
Apologies for late reply.
Due to security reasons, path to the folder on the server cannot be easily set in HTML code when creating the CKFinder instance, but that's doable and quite simple.
Suppose you're editing an article #12345.
Set CKFinder id to "folder12345".
On the server side, in the configuration file, read "id" from the query string and based on that value set the baseUrl/baseDir variable. If you need help with that, let me know what's your server side version of CKFinder and I will try to paste some sample code.
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Custom Upload Directory Per Object
Thanks I'll give that a go!