How to change image loading path * dynamically * in FCKeditor

I am using ASP.NET binary for my FCKeditor and you need to insert two editors on the same page. Uploaded images / view need to go to two different directories, how to do it from the code?

I know that the path for the downloaded files is set to config.ascx-file with the parameter UserFilesPath, but I cannot find a way to override this value from my file aspx.cs.

Also, I found (inconsistent) documentation about what Session["FCKeditor:UserFilesPath"]can be installed, but I don't want to put usercontrol specific information in a global session variable.

+5
source share
5 answers

[ "UserInfo" ]

[ fckeditor]/filemanager/connector/aspx/config.ascx

string Userfolder = Session["UserInfo"].ToString(); // URL path to user files. UserFilesPath = "~/Upload/" + Userfolder;

+1

, , , , :

fckEditor1.Config

. , :

fckEditor1.Config [ "UserFilesPath" ] = " "

0

, , . , .

Session["FCKeditor:UserFilesPath"] = "~/images/";
0

, , javascript api.

0

: FCK editor 2.x: // FCKeditor, $Config ['UserFilesPath']

. , php-. /, , . , FCKeditor - , . FCKeditor . FCKeditor. , , . , . $Config ['UserFilesPath'] , , FCKeditor . . FCKeditor 2.5.1 VersionBuild 17566, , . , , , FCKeditor.

1) fckeditor\editor\filemanager\connector\phpconfig.php

a) $Config; $Config ['Enabled'] = false; i) , , : : .. FCKeditor , FCKeditor , :

if(!isset($_SESSION)){
session_start(); 
}

if(isset($_SESSION['SESSION_SERVER_RELATIVEPATH']) && $_SESSION['SESSION_SERVER_RELATIVEPATH']!="") { 
$relative_path=$_SESSION['SESSION_SERVER_RELATIVEPATH']; 
include_once($_SERVER['DOCUMENT_ROOT'].$relative_path."configurations/configuration.php");
}

N.B.: $_SESSION ['SESSION_SERVER_RELATIVEPATH']: , webroot; "/project/folder/path/" , . /configuration.php. , /configuration.php

ii) FCKeditor , , , ( , ). , , , (iii), ( ). :

if(!isset($_SESSION)){
session_name($_REQUEST['param_project_to_fck']); 
session_start(); 
}

if(isset($_SESSION['SESSION_SERVER_RELATIVEPATH']) && $_SESSION['SESSION_SERVER_RELATIVEPATH']!="") { 
$relative_path=$_SESSION['SESSION_SERVER_RELATIVEPATH']; 
include_once($_SERVER['DOCUMENT_ROOT'].$relative_path."configurations/configuration.php");
}

, N.B. , (i)

iii) FCKeditor , , ( ). :

if(isset($_REQUEST['param_project_to_fck']) && $_REQUEST['param_project_to_fck']!=""){ //base64 encoded relative folder path of the project corresponding to the webroot; should be like "/project/folder/path/" before encoding 
$relative_path=base64_decode($_REQUEST['param_project_to_fck']);
include_once($_SERVER['DOCUMENT_ROOT'].$relative_path."configurations/configuration.php");
}

, N.B. (i)

b) , , :

// Path to user files relative to the document root.
$Config['UserFilesPath'] = '/userfiles/' ;

:

if(isset($SERVER_RELATIVEPATH) &&  $SERVER_RELATIVEPATH==$relative_path) { //to make it relatively secure so that hackers can not create any upload folder automatcally in the server, using a direct link and can not upload files there 
$Config['Enabled'] = true ;
$file_upload_relative_path=$SERVER_RELATIVEPATH;
}else{
$Config['Enabled'] = false ;
exit();
}
// Path to user files relative to the document root.
//$Config['UserFilesPath'] = '/userfiles/' ;
//$Config['UserFilesPath'] = $file_upload_relative_path.'userfiles/' ;
$Config['UserFilesPath'] = '/userfiles'.$file_upload_relative_path;

$SERVER_RELATIVEPATH - , , .

$Config ['UserFilesPath'] , $file_upload_relative_path. bluehost linux, ( 0755) userfiles ( 0777 FCKeditor), . , userfiles - ( ) 0777, $config :

$Config['UserFilesPath'] = '/userfiles'.$file_upload_relative_path; 

, ( ):

$Config['UserFilesPath'] = $file_upload_relative_path.'userfiles/' ;

, $Config ['UserFilesPath'] = '/userfiles/'; , .

2) 1) (a) (ii) (iii),
(a) fckeditor\editor\filemanager\browser\default\browser.html.

: var sConnUrl = GetUrlParam ('Connector');

:

var param_project_to_fck = GetUrlParam( 'param_project_to_fck' ) ; 

: sUrl + = '& CurrentFolder =' + encodeURIComponent (this.CurrentFolder);

:

sUrl += '&param_project_to_fck=' + param_project_to_fck ; 

(b) ckeditor\editor\filemanager\browser\default\frmupload.html.

( SetCurrentFolder()):

sUrl += '&CurrentFolder=' + encodeURIComponent( folderPath ) ;

:

sUrl += '&param_project_to_fck='+window.parent.param_project_to_fck;

3) , FCKeditor , php /:

include_once(Absolute/Folder/path/for/FCKeditor/."fckeditor/fckeditor.php") ; 
$oFCKeditor = new FCKeditor(Field_name_for_editor_content_area) ;
$oFCKeditor->BasePath = http_full_path_for_FCKeditor_location.'fckeditor/' ;
$oFCKeditor->Height = 400;
$oFCKeditor->Width = 600;
$oFCKeditor->Value =Your_desired_content_to_show_in_editor;
$oFCKeditor->Create() ; 

a) , 1) (a) (ii) (iii), : $oFCKeditor- > Create();

$oFCKeditor->Config["LinkBrowserURL"] = ($oFCKeditor->BasePath)."editor/filemanager/browser/default/browser.html?Connector=../../connectors/php/connector.php&param_project_to_fck=".base64_encode($SERVER_RELATIVEPATH);
$oFCKeditor->Config["ImageBrowserURL"] = ($oFCKeditor->BasePath)."editor/filemanager/browser/default/browser.html?Type=Image&Connector=../../connectors/php/connector.php&param_project_to_fck=".base64_encode($SERVER_RELATIVEPATH);
$oFCKeditor->Config["FlashBrowserURL"] = ($oFCKeditor->BasePath)."editor/filemanager/browser/default/browser.html?Type=Flash&Connector=../../connectors/php/connector.php&param_project_to_fck=".base64_encode($SERVER_RELATIVEPATH);

b), 1) (a) (ii), : base64_encode ($ SERVER_RELATIVEPATH) : base64_encode (session_name())

.

0

All Articles