Showing posts with label flash. Show all posts
Showing posts with label flash. Show all posts

Thursday, May 29, 2008

Uploading Images using Fckeditor

In my previous Blog ,I did write about integrating Fckeditor in Visual studio Projects .
Today ,I will guide you about enabling the Image,Flash file upload in fckeditor.
Due to security reasons this feature is disabled by default .
Once you get the Editor working follow these steps to get upload working .....

1.Create a Folder named "userfiles" in the root directory and add two subfolders to it named image and flash .

2.Go to the web.config file ,In the appSettings write the following code .....

(appSettings)
( add key="FCKeditor:UserFilesPath" value="~/userfiles/"/)
(/appSettings)

3. Go to fckeditor/fckconfig.js and search for
var _FileBrowserLanguage and var _QuickUploadExtension
change the file type to 'aspx' like the below code

var _FileBrowserLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py

4. Now move to fckeditor/editor/filemanager/connectors/aspx/config.ascx
find the private bool Check_Authenticate () function
Here you need to tweak the code according to your needs .
If you want only authenticated users to access your browserfiles then add this code
return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );
//else you can make use of your own custom made function .

else an easy but a bad option is
return true;//not suggested

5. In the same file you need to define the path of your userfile folder .


// URL path to user files.
UserFilesPath = "/userfiles/";
//Absolute path to userfiles
UserFilesAbsolutePath = "C:\\Users\\Documents\\Visual Studio 2008\\WebSites\\ Website\\userfiles\\";

6. The Final Step ,pray to god that it works at last

It took me a week to figure out the way to integrate it and make it work finally ,I hope this Blog will make it a lot more simpler for you now .
I have used version 2.6 of Fckeditor , Visual studio 2008 and .net fx 3.5 for my project.
I hope it works the same with visual studio 2005 and .net fx 2.0.

If you still face any problem with it ,do mail me your problem and I will try to Fix it .