Posted by: prajapatinilesh | November 20, 2007

Easy Step to configure to upload images in fck editor in php

p1.php -> and also put whole fckeditor folder in same folder where your p1.php file is available for just testing my example otherwise you need to set your self some required file path for files……

<?
require(“fckeditor/fckeditor.php”);
?>
<html>
<head>This is head <title> this is title</title>
<script type=”text/javascript” src=”fckeditor/fckeditor.js”></script></head>

<body>

<?
$sBasePath=”fckeditor/”;
$oFCKeditor = new FCKeditor(‘FCKeditor1’) ;
$oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->Value = $contentVal_1 ;

//for to display fck editor….
$oFCKeditor->Create();
?>

</body>

</html>

************************************************************************

Configure FCKEditor
Edit ::: fckeditor\fckconfig.js

Uncomment the line

Code:
\\ FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code

to read

Code:
FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code

Change the folllowing lines from;

Code:
var _FileBrowserLanguage = ‘asp’ ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = ‘asp’ ; // asp | aspx | cfm | lasso | php

to;

Code:
var _FileBrowserLanguage = ‘php’ ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = ‘php’ ; // asp | aspx | cfm | lasso | php


Edit ::: fckeditor\editor\filemanager\browser\default\connectors\php\config.php

Change

Code:
$Config[‘Enabled’] = false ;

to

Code:
$Config[‘Enabled’] = true ;

Edit :::
fckeditor\editor\filemanager\upload\php\config.php

Change

Code:
$Config[‘Enabled’] = false ;

to

Code:
$Config[‘Enabled’] = true ;

and

Code:
$Config[‘UserFilesPath’] = ‘/userfiles/’ ;

to

Code:
$Config[‘UserFilesPath’] = ‘/userfiles/images/’ ;

Edit php.ini (in your apache\bin and your php folder)

Change

Code:
upload_tmp_dir = “C:\xampp\tmp”


to

Code:
upload_tmp_dir = “C:\xampp\userfiles”

After changing in php.ini file just restart your apache server…

if you donot want to change php.ini file than just change the path for

$Config[‘UserFilesPath’] = ‘/yourSiteFolderName/fckImages/’ ;

And create folder:

    htdocs\yourSiteFolderName\fckImages\

htdocs\yourSiteFolderName\fckImages\file

htdocs\yourSiteFolderName\fckImages\images

htdocs\yourSiteFolderName\fckImages\flash

htdocs\yourSiteFolderName\fckImages\media

in short that path should be exist……..

Edit

fckeditor\editor\filemanager\upload\php\upload.php

Change (line 93)

Code:
$sServerDir .= $sType . ‘/’ ;

to

Code:
$sServerDir .= strtolower($sType) . ‘/’ ;


Change (line119)

Code:
$sFileUrl = $Config[“UserFilesPath”] . $sType . ‘/’ . $sFileName ;

to

Code:
$sFileUrl = $Config[“UserFilesPath”] . strtolower($sType) . ‘/’ . $sFileName;


Create the folders;

    htdocs\userfiles
    htdocs\userfiles\file
    htdocs\userfiles\images
    htdocs\userfiles\flash
    htdocs\userfiles\media

Once I had done all of the above I was able to upload images and files.

Thanks,

Nilesh Prajapati…… 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: