I need to be able to set a dynamic userfilespath and userfiles URL when instantiating the FCK Editor in PHP. I need to force the upload of all images, pdf's, etc. into the $client_path (in the code below). Also, when it loads the image in the preview and inserts it into the editor code, I need to force the URL it loads from as $client_url. Any help on this would be GREATLY appreciated. Thank you!
$oFCKeditor = new FCKeditor('body'); $oFCKeditor->BasePath = 'fck/'; $oFCKeditor->Width = 750; $oFCKeditor->Height = 500; $oFCKeditor->Value = $ed_body; $oFCKeditor->Config['EnterMode'] = 'br'; $oFCKeditor->Config['UserFilesPath'] = $client_path; $oFCKeditor->Create();
Re: FCK Editor - Configuring PHP Image Upload
I'm subscribing to this post. Hope we get an answer soon.
Cy
Re: FCK Editor - Configuring PHP Image Upload
If you haven't found the anser yet, here it is.
http://www.fckeditor.net/forums/viewtopic.php?f=6&t=11917&p=31210&hilit=UserFilesPath+dynamic#p31210
Be sure to put the session start code at the top of both pages. The page the editor is on, and the config page.
I commented out the line that was in the config.
Then I put in the session variable I created.
Re: FCK Editor - Configuring PHP Image Upload
Here's the original page that calls FCKeditor:
$newPath = "/projects/images";
<form action="postdata.php" method="post" target="_blank">
<?php
$oFCKeditor = new FCKeditor('FCKeditor1') ;
$oFCKeditor->Height = 600;
$oFCKeditor->BasePath = '/fckeditor/' ;
$oFCKeditor->Config['UserFilesPath'] = $_SESSION[$newPath];
$oFCKeditor->Value = html_entity_decode(stripslashes($body));
$oFCKeditor->Create() ;
?>
<br />
<input type="submit" value="Submit" />
and here's my code segment from config.php:
$Config['UserFilesPath'] = $_SESSION[$newPath];
of course the original$Config['UserFilesPath'] is commented out. I'm pretty sure all that is incorrect because I don't know how newPath would get passed over to the config page. And am I supposed to have the $oFCKeditor-> in front of the config or is it just the $Config['UserFilesPath'] in the original file also?
Re: FCK Editor - Configuring PHP Image Upload
Inside file which calls the FCKeditor:
<?php session_start(); //this goes at the top of the page. ?>
<?php
$_SESSION["newPath"] = "/projects/images"; //you can replace this with a value passed into the page through a form or whatever
?>
<form action="postdata.php" method="post" target="_blank">
<?php
$oFCKeditor = new FCKeditor('FCKeditor1') ;
$oFCKeditor->Height = 600;
$oFCKeditor->BasePath = '/fckeditor/' ;
$oFCKeditor->Config['UserFilesPath'] = $_SESSION["newPath"];
....etc
?>
...etc
in config.php file:
<?php
session_start(); //this goes at the top of the page.
$Config['UserFilesPath'] = $_SESSION["newPath"]; //this replaces what is currently set for userFilesPath
?>
That will allow you to insert images into a pre-defined or dynamically defined directory of your choice. Now I have to figure out how to view the files that are already there. when I try to do an upload I'd like to see the images that are currently in the directory so I can choose from them if I want to use one.
Re: FCK Editor - Configuring PHP Image Upload
The same problem, but the solution doesn't seem to work for me:
I'm running version 2.6.4 and I want to have each user to have his own directory for uploading files. I have the following code:
In file config.php:
In my file that uses FCKeditor:
But the system seems to ignore the setting in my file and goes to the root level directory -- not to the subdirectory for the user. I have tried adding the following just before instantiating FCKeditor but it didn't solve the problem:
Anybody know what the problem is?
TIA,
Pete
Re: FCK Editor - Configuring PHP Image Upload
I also need to change the directory name of the upload files dynamicly
I have few forms, each form need to save the upload files in a seperate directory, which is different from the others.
I tried to something similar to :
$oFCKeditor = new FCKeditor('body');
$oFCKeditor->BasePath = 'fck/';
$oFCKeditor->Width = 750;
$oFCKeditor->Height = 500;
$oFCKeditor->Value = $ed_body;
$oFCKeditor->Config['EnterMode'] = 'br';
$oFCKeditor->Config['UserFilesPath'] = $client_path;
$oFCKeditor->Create();
with no success.
What is the right and clear way to do it?
Shlomit.
Re: FCK Editor - Configuring PHP Image Upload
Maybe something in combination with $_POST()?
In folder \editor\filemanager\connectors\php\ you will find all files you need I suppose.
Re: FCK Editor - Configuring PHP Image Upload
Re: FCK Editor - Configuring PHP Image Upload
I'll try again, but I was just wondering if anyone has another method that DOESN'T use SESSION variables ?
Thanks :~)
Re: FCK Editor - Configuring PHP Image Upload
Re: FCK Editor - Configuring PHP Image Upload