Link to home
Start Free TrialLog in
Avatar of DragXSlay
DragXSlayFlag for United States of America

asked on

FCK Editor - Configuring PHP Image Upload

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;

Open in new window

Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

If I understand your question correctly, you are saying you want the program on the server to choose the file(s) on the client machine that get uploaded.

You can't do that, and if you find a way to do it, the www security community will be quick to shut it down.  This is simply a security risk that is considered unacceptable.

Please let me know if I'm missing something.  Thanks, ~Ray
Avatar of DragXSlay



No, I'm sorry if I'm not explaining this properly.  The user is going to decide what files to upload.  I just want to be able to tell the editor where to store these files.  As in, what folder on the drive.  Basically, I'm asking how do I tell the editor which path to use and, as a result of this, which URL to use when loading the image.
Got it.  See if this is helpful:

Cheers, ~Ray
The problem is, that link shows how to change thew directory via the config file.  I need some way to do it while instantiating the editor itself.  Something like:

$oFCKeditor->Config['UserFilesPath'] = $client_path;

The config file will be used across all the sites I'm planning to install it on, so the file loading it is the one that has to change the appropriate directories.  Any ideas?
Avatar of DragXSlay
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent.  You can close the question by accepting your own solution as the answer, and that will PAQ it for others who come searching.  Best regards, ~Ray