Hi All,
Is there a way to set the root image path for CKFinder at runtime through the use of code or a session value?
In fckEditor it canbe done using Session["FCKeditor:UserFilesPath"]= absolutePath;
However is there a way to do this in ckFinder?
I can't see that the path for this would be set in stone in the config file while the path in fckEditor which uses CKFinder can be dynamic. Can it get its root path from fckEditor if used by this app?
Cheers
PowerD
Is there a way to set the root image path for CKFinder at runtime through the use of code or a session value?
In fckEditor it canbe done using Session["FCKeditor:UserFilesPath"]= absolutePath;
However is there a way to do this in ckFinder?
I can't see that the path for this would be set in stone in the config file while the path in fckEditor which uses CKFinder can be dynamic. Can it get its root path from fckEditor if used by this app?
Cheers
PowerD
Re: Set CKFinder Image path dynamically.
(or anything else you have set)
the trick is to assign there session variables:
those variables may be changed anywhere in your application as long as you have session_start() at the top of your scripts.
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Set CKFinder Image path dynamically.
I am desperate to find out how to change this path dynamically in ASP.Net. I need to use the same CKfinder instance to get/upload images to different folders depending on the logged in user.
Can anyone shed some light, there seems to be a solution for PHP...
Thanks,
Paul Hinett
UK Creative Designs
http://www.ukcreativedesigns.com
Re: Set CKFinder Image path dynamically.
Re: Set CKFinder Image path dynamically.
So if you set the sessions
SESSION["ckfinder_baseUrl"] = <insertbaseurl>;
SESSION["ckfinder_baseDir"] = <insertbasedir>;
It just might work, I personally havnt had the time to try it.
Re: Set CKFinder Image path dynamically.
I've also tried to set the Session variable to ["ckfinder_baseUrl"] and ["CKFinder:BaseUrl"] leaving the <BaseDirectory url="" /> field empty.
After that i tried to use <BaseDirectory url="%SERVER(CKFinder_BaseUrl)%" /> in ckfinder.config but nothing helped.
I would prefer to have an option to set the BaseUrl through a Session variable. Alternatively i would like to have a way to set the ckfinder.config settings with ASP.NET server-side variables.
Re: Set CKFinder Image path dynamically.
Change ckfinder.config to be
<BaseDirectory
url = "%SERVER(myUrl)%"
serverPath = ""
/>
Then set a session variable on Page_Load that matches the name of what is in parentheses:
protected void Page_Load(object sender, EventArgs e)
{
Session["myUrl"] = "/mydocuments/";
}
worked for me!
Re: Set CKFinder Image path dynamically.
sometimes is actually uses %SERVER(myUrl)% as the value and even creates this folder
it may start browsing to the value of this variable and after a while simply continues to browse the %SERVER(myUrl)% folder
any ideas why?
Re: Set CKFinder Image path dynamically.
CKFinder created folder %SERVER(UserFiles)% in ckfinder/core/connector/aspx and drops there uploaded files.
UPDATE
I have a mistake. CKFinder created folder c:\ckfinder and drops uploaded files there. But in ckfinder/core/connector/aspx/%SERVER(UserFiles)% it created _thumbs folder and drops there thumbnails of images.
It's very misunderstanding.
Re: Set CKFinder Image path dynamically.
Re: Set CKFinder Image path dynamically.
Re: Set CKFinder Image path dynamically.
I constantly face the situation when user needs to upload 10-15 items to database and each item has a photo or attached file. All this stuff is stored in one directory. Directory structure is 4-5 levels depth, so a user has to perform 5*15 clicks instead of just 15.
So the feature may sound following way:
1) Make OPTION to "remember last directory", which will be stored in current session. This will solve 95% of user requests for similar feature.
2) Make dynamically customizable "default" directory to pop-up CKfinder in. This is for those who are not satisfied with 1).
The algorythm should sound like:
if (custom start directory is set via session) {
try to use it as starting dir
} elseif (enabled remember last dir feature) {
try to use it as starting dir
} else {
start from root dir
}
Re: Set CKFinder Image path dynamically.
// force CKFinder to use specific directory, we want to suggest user to choose image from specific location regardless of last used directory
if (custom start directory is set via session) {
try to use it as starting dir
} elseif (enabled remember last dir feature in a cookie) {
try to use it as starting dir
} else if (start directory is set in config file){
try to use it as starting dir
} else {
start from root dir
}
Alternatively:
(actually it should do the same as above)
if (isset(SESSION[start directory]) and SESSION[force start directory] == true) {
try to use it as starting dir
} elseif (CONFIG[remember last directory] == true and isset(COOKIE[start directory])) {
try to use it as starting dir
} else if (isset(SESSION[start directory]) and SESSION[force start directory] == false){
try to use it as starting dir
} else {
start from root dir
}
The main idea is that it should be also possible to set the "priority" of start directory.
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Set CKFinder Image path dynamically.
emphasis on the + (string)Session["uName"]; - i create the uName session variable on login (using vb)
hope this helps a few people,
Thanks
Ally
Re: Set CKFinder Image path dynamically.
in browser.html change
oConnector.CurrentFolder = '/';
to
oConnector.CurrentFolder = getCookie('currentFolder');
if (oConnector.CurrentFolder != null && oConnector.CurrentFolder != "") {
//alert(oConnector.CurrentFolder);
}
else {
oConnector.CurrentFolder = '/';
}
and in oConnector.SendCommand = function( command, params, callBackFunction )
after
// Add a random salt to avoid getting a cached version of the command execution
sUrl += '&uuid=' + new Date().getTime();
add
// remember path
if (this.CurrentFolder != null && this.CurrentFolder != "") {
setCookie('currentFolder', this.CurrentFolder, 365);
}
and you need add somewhere
function setCookie(c_name, value, expiredays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
document.cookie = c_name + "=" + escape(value) +
((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
}
function getCookie(c_name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1) c_end = document.cookie.length;
return unescape(document.cookie.substring(c_start, c_end));
}
}
return "";
}
Re: Set CKFinder Image path dynamically.
@pidibi - check the documentation: http://docs.fckeditor.net/CKFinder/Deve ... ntegration
There are at least two settings that you might be interested in: StartupPath and RememberLastFolder.
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Set CKFinder Image path dynamically.
I'm looking to implement this within my coldfusion application, but to the function doesn't seem to be working.
Within Javascript i have:
var finder = new CKFinder() ;
finder.id = 'localclientapp' ;
finder.StartupPath = startupPath ;
finder.StartupFolderExpanded = true ;
finder.RememberLastFolder = true ;
Do I need to enable anything else?
Many thanks
Shafiq :sK
Re: Set CKFinder Image path dynamically.
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Set CKFinder Image path dynamically.
Re: Set CKFinder Image path dynamically.
I was able to determine the baseUrl with a session variable in classic asp. trust me. Not my preferred language but hey a gig is a gig.
I know this is an old thread,
I know this is an old thread, but I got it to work in ASP.Net with session variables as well.
I put the session variables in my Global.asax file:
In config.ascx change the BaseURL and Resource sections to read a session.
And then finally in the page load where the control is:
Hope that helps someone. Took me awhile to understand the whole resource thing myself.