locked
Fck Editor Image uploading problem RRS feed

  • Question

  • User818317961 posted

    hi, visual studio 2005

    I am using FCKEditor in my project using Visual Web Developer Express. It is working fine with normal features. I am unable to upload image to the server

    or browse the images directory.

    I am using FCKeditor.Net_2.2 .net control. 

     In the web config i have added the code to change the image directory  <add key="FCKeditor:UserFilesPath" value="/UserFiles/" />

     In the fckconfig.js, i have made the following changes.

    var

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

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

    The upload image still not working.

     

    Wednesday, October 10, 2007 6:51 AM

Answers

  • User818317961 posted

    hi guys

    i found a solution for this problem through internet

    its worked fine for me

    Explanation :

    I found the solution after hours... this is kind of tricky, not a very clean solution. But it seems to work... Confused

    First I try to deal the problem by changing the paths config in connectors.. but anyway.. I couldn't succeed in using absolute path for my images from those paths.

    So, I decided to debug the editor, and I come finally to the following file : editor/dialog/fck_image/fck_image.js
    There are many functions described in this Java Script file. They are used in the image interface dialog.
    And particularly, the function UpdateOriginal() is called when the image is loaded for preview in the bottom right of the dialog (at the opening of the dialog if it is the result of showing property of an existing image, or when the user has chosen an new image from the browser).

    I added the following code in this function so as to be able to work with images having an absolute path. So, the images are well shown while editing!!!!

    <CENTER>
    Code:
    function UpdateOriginal( resetSize )
    {
       if ( !eImgPreview )
          return ;

       if ( GetE('txtUrl').value.length == 0 )
       {
          oImageOriginal = null ;
          return ;
       }

       oImageOriginal = document.createElement( 'IMG' ) ;   // new Image() ;

       if ( resetSize )
       {
          oImageOriginal.onload = function()
          {
             this.onload = null ;
             ResetSizes() ;
          }
       }

       oImageOriginal.src = eImgPreview.src ;

    //######################################--- ADDED ---###################################################
    //to be able to have absolute path all the time for images located in the local server- XELAG - 21.08.07 
        var mySite = 'http://www.mywebsite.com'; //the adresse to your website ex: 'http://www.mywebsite.com'  (no '/' at the end)
           
        if(GetE('txtUrl').value.substr(0,7) != 'http://') //test if the path is not already absolute
        {
            GetE('txtUrl').value = mySite + GetE('txtUrl').value; //if not the case, add the root path to webste
            UpdatePreview();
        }
    //#######################################################################################################   
         
    }
     </CENTER>

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 11, 2007 9:10 AM

All replies

  • User818317961 posted

    hi guys

    i found a solution for this problem through internet

    its worked fine for me

    Explanation :

    I found the solution after hours... this is kind of tricky, not a very clean solution. But it seems to work... Confused

    First I try to deal the problem by changing the paths config in connectors.. but anyway.. I couldn't succeed in using absolute path for my images from those paths.

    So, I decided to debug the editor, and I come finally to the following file : editor/dialog/fck_image/fck_image.js
    There are many functions described in this Java Script file. They are used in the image interface dialog.
    And particularly, the function UpdateOriginal() is called when the image is loaded for preview in the bottom right of the dialog (at the opening of the dialog if it is the result of showing property of an existing image, or when the user has chosen an new image from the browser).

    I added the following code in this function so as to be able to work with images having an absolute path. So, the images are well shown while editing!!!!

    <CENTER>
    Code:
    function UpdateOriginal( resetSize )
    {
       if ( !eImgPreview )
          return ;

       if ( GetE('txtUrl').value.length == 0 )
       {
          oImageOriginal = null ;
          return ;
       }

       oImageOriginal = document.createElement( 'IMG' ) ;   // new Image() ;

       if ( resetSize )
       {
          oImageOriginal.onload = function()
          {
             this.onload = null ;
             ResetSizes() ;
          }
       }

       oImageOriginal.src = eImgPreview.src ;

    //######################################--- ADDED ---###################################################
    //to be able to have absolute path all the time for images located in the local server- XELAG - 21.08.07 
        var mySite = 'http://www.mywebsite.com'; //the adresse to your website ex: 'http://www.mywebsite.com'  (no '/' at the end)
           
        if(GetE('txtUrl').value.substr(0,7) != 'http://') //test if the path is not already absolute
        {
            GetE('txtUrl').value = mySite + GetE('txtUrl').value; //if not the case, add the root path to webste
            UpdatePreview();
        }
    //#######################################################################################################   
         
    }
     </CENTER>

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 11, 2007 9:10 AM
  • User-1310388473 posted

    Thanks Vinogays for your workin' solution,

    but in my opinion it's quite "hard way" -- did someone find some other solution? (without changing source js files of fckeditor) Or there are really mistakes in js files during fckeditor + asp.net combination? What about making hyperlinks and uploading files -- there remains problem with absolute path. Do I have to change fck_link.js?

    Any help will be appreciated..

    Sunday, October 21, 2007 8:23 AM
  • User-1502764745 posted
    <ADD value="~/UserFiles/" key="FCKeditor:UserFilesPath"><add key="FCKeditor:UserFilesPath" value="~/UserFiles/" /> </ADD>
    Tuesday, October 23, 2007 5:28 AM
  • User818317961 posted

    Hi thank for reply ..

    i have given like this but its not working ..................!!!!!!!!!!

    Tuesday, October 23, 2007 5:41 AM
  • User-378245712 posted

    I have gotten my mines to work without any additional coding but a bit of modification to the fckeditor settings. Have you given directory access for ASP.NET?

    Monday, November 5, 2007 3:37 PM
  • User-2050545975 posted

     Hi

    change the app settings to this

    <appSettings>
        <add key="FCKeditor:UserFilesPath" value="~/UserFiles/" />
      </appSettings>

    now it works

    i'm using fckeditor in "admin" folder in my web application 

    if u r also using the same then 

     go to "FckEditor\Editor\FileManager\browser\default\frmresourcelist.html" in ur project


    function GetFoldersAndFilesCallBack( fckXml )
    {
        if ( oConnector.CheckError( fckXml ) != 0 )
            return ;

        // Get the current folder path.
        var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
        if ( oFolderNode == null )
        {
            alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' ) ;
            return ;
        }
        var sCurrentFolderPath    = oFolderNode.attributes.getNamedItem('path').value ;
        var sCurrentFolderUrl    = oFolderNode.attributes.getNamedItem('url').value ;
            // My Change
    //  
       //   alert(sCurrentFolderUrl);
    //    var dTimer = new Date() ;

        var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' ) ;

        // Add the Folders.
        var oNodes ;
        oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
        for ( var i = 0 ; i < oNodes.length ; i++ )
        {
            var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
            oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ) ;
        }

        // Add the Files.
        oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
        for ( var j = 0 ; j < oNodes.length ; j++ )
        {
            var oNode = oNodes[j] ;
            var sFileName = oNode.attributes.getNamedItem('name').value ;
            var sFileSize = oNode.attributes.getNamedItem('size').value ;

            // Get the optional "url" attribute. If not available, build the url.
            var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url') ;
             // My Change 1  enter this line 
              sCurrentFolderUrl=sCurrentFolderUrl.replace("~/","");
            //sCurrentFolderUrl='UserFiles/Image/';
            var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : sCurrentFolderUrl + sFileName ;
            oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) ) ;
        }

        oHtml.Append( '<\/table>' ) ;

        document.body.innerHTML = oHtml.ToString() ;

    //    window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;

    }

     


    check the text which is in italic

    hope this works for u but one problem is we can't see the image in preview if u get sol for this then plz send the code

    gud luck

    thank u

    archu 

    Wednesday, December 12, 2007 8:10 AM
  • User-2050545975 posted

     Hi frds I got the solution but don't knw whether it is the right way or not

    I have used fckeditor2.2 with asp.net2.0 

    1)My application name is "SampleApplication"

    2)in this application  i have place "fckeditor" folder and

    also placed the dlls( related to fckeditor) in bin folder of  "SampleApplication"

    3)Go to the folder  fckeditor ->editor->images

    in this u create a folder for storing the files/images which are uploaded

    I hav created a folder called "UserFilesUpload" in images folder

     

    4)Now place the following statement in  web.config file of the application 

    <appsettings> 

    <add key="FCKeditor:UserFilesPath" value="/SampleApplication/fckeditor/editor/images/UserFilesUpload" /> 

    </appsettings> 

    5)Now run the application when u upload the image it will be seen in preview 

    when u click ok it will be stored in the folder which u have created

     and displayed to the user or front page

     

    Note:1) nothing to be changed in  the code of js files of fckeditor

    2)just create folder in this " fckeditor/editor/images/ "

    3)giv the whole path in the <addkey > of web.config file

     

    Hope this will be helpful to all those who r facing this problem 

    gudluck

    thank u

    Archu 

    Thursday, December 13, 2007 5:54 AM
  • User662360383 posted

     Eso me funcionó de maravilla. Thanks for that post, I was having some troubles with the image previewing but now it is working really well.

     

    Sorry for my english. 

    Monday, January 7, 2008 8:48 PM
  • User1677247544 posted

    Hi,


    I dont know whether you guys have found a solution to this problem but I was also facing a lot of trouble uploading images using the FCKeditor..But after hours of hit and trials i was finally able to upload images using the FCKeditor..But i still dont know how it works...

    1) Firstly i modified fckconfig.js as


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

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


    2)Secondly i modified the "\fckeditor\editor\filemanager\connectors\aspx\config.ascx" file as


    <script runat="server">

    /**

    * This function must check the user session to be sure that he/she is

    * authorized to upload and access files in the File Browser.

    */

    private bool CheckAuthentication()

    {

    // WARNING : DO NOT simply return "true". By doing so, you are allowing

    // "anyone" to upload and list the files in your server. You must implement

    // some kind of session validation here. Even something very simple as...

    //

    // return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );

    //

    // ... where Session[ "IsAuthorized" ] is set to "true" as soon as the

    // user logs in your system.

    return true;

    }

    public override void SetConfig()

    {

    // SECURITY: You must explicitly enable this "connector". (Set it to "true").

    Enabled = CheckAuthentication();

    // URL path to user files.

    UserFilesPath = "~/fckeditor/editor/filemanager/connectors/Media";

    // The connector tries to resolve the above UserFilesPath automatically.

    // Use the following setting it you prefer to explicitely specify the

    // absolute path. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.

    // Attention: The above 'UserFilesPath' URL must point to the same directory.

    UserFilesAbsolutePath = "C:\\inetpub\\wwwroot\\MyWebsite\\fckeditor\\editor\\filemanager\\connectors\\Media\\";


    3) Lastly i added customconfigurationpath to my control as


    basepath="~/fckeditor/" customconfigurationspath="/fckeditor/fckconfig.js"


    After doing all this my editor is uploading and displaying files perfectly.

    Saturday, August 23, 2008 10:22 AM
  • User-1318143558 posted

    its working for my local host ..

    but i am getting error on server while uploading image

    error is..

     

    The server didn't send back a proper XML response. Please contact your system administrator.

    XML request error: Found (302)

    Requested URL:
    /FCKeditor/editor/filemanager/connectors/aspx/connector.aspx?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=%2F&uuid=1232723528410

    Response text:
     

    i am using asp.net 2.0 with c#

    please help me to solve it

     Thanks & regards

    Jack

    Friday, January 23, 2009 10:13 AM
  • User-1501204699 posted

    Hi jack_tom .. I thnk the absolute path on your web server is different from that on your local machine..

    Monday, January 26, 2009 6:19 AM
  • User-1318143558 posted

     Thanks for reply kushkashyap.

    what should be the absolute path for running on server.

    i tried many times but not getting result.

    what should be the path for that.

    could you please justify the solution.

    i am waiting for your reply

    Thanks in advance

     

    Wednesday, January 28, 2009 1:19 AM
  • User-1501204699 posted

    Hi jack_tom...by absolute path we mean the actual path of your directory in the web server.. So when you are running it on your local machine or localhost it is running fine. But your webserver may not have the same directory structure as your local server..They might have used some other structure. So you just need to contact your web server people about it and then modify your path accordingly..only the path prior to your root directory needs to be changed to map correctly on your remote site..

    Since every webserver can have different directory structure so i can't specify the correct one for you, you just talk to them.

    I hope my solution helps you.

    All the best.

    Wednesday, January 28, 2009 6:11 AM
  • User-1501204699 posted

    Hi jack_tom...by absolute path we mean the actual path of your directory in the web server.. So when you are running it on your local machine or localhost it is running fine. But your webserver may not have the same directory structure as your local server..They might have used some other structure. So you just need to contact your web server people about it and then modify your path accordingly..only the path prior to your root directory needs to be changed to map correctly on your remote site..

    Since every webserver can have different directory structure so i can't specify the correct one for you, you just talk to them.

    I hope my solution helps you.

    All the best.

    Wednesday, January 28, 2009 6:14 AM
  • User-1501204699 posted

     Hi jack_tom, i am sure by now you would have resolved your problem. But i just came across a solution to this problem so i am sharing it with you..

    just modify the connector.aspx file as 

     

    // URL path to user files.
    		UserFilesPath = "~/Resources/ArticleData/";
    
    		// The connector tries to resolve the above UserFilesPath automatically.
    		// Use the following setting it you prefer to explicitely specify the
    		// absolute path. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
    		// Attention: The above 'UserFilesPath' URL must point to the same directory.
    
            string ap = HttpContext.Current.Server.MapPath("~/Resources/ArticleData/");
    		UserFilesAbsolutePath = ap;
      This will resolve your problem.
    Saturday, March 28, 2009 3:34 PM
  • User-1318143558 posted

    Thank you very much KushKasyap

     I got it..

     and sorry for so late response.

     

    today i have problem .....

    i want to print the text on a image with the inner and outer colour

    means the text will be having border with some width and color.

    I tried with GDI but not getting the Image quality

     Can you please give me code to sort out this problem 

     

    Thanks in advance

    Jack


    Tuesday, April 21, 2009 10:16 AM
  • User-991509196 posted

    Hi archu,

    i have implemented you changes for FCK editor.its working fine...

    i images are not previewing... could you plz help me out..

    thanks

    Tariq 

    Thursday, July 16, 2009 1:49 AM
  • User-1112204889 posted

    rather than uploading to the webserver

    for security purposes, uploading and storing the files in the database is safer

    the primary advantage is to reduce the user from uploading scripts/virus that could be harmful to your production web servers

    i've build a component which allows users to uploads and stores files into a database as binary, this removed the scripts/virus threat that most production web servers fear

    http://forums.asp.net/p/1345832/2735110.aspx


    Saturday, August 15, 2009 8:28 AM
  • User1863814280 posted

    I had this error too.


    After debugging a litle the java script in browser.html, I found out the editor is calling this URL:


    http://localhost:1923/controls/fckeditor/editor/filemanager/connectors/aspx/connector.aspx?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=%2F&uuid=1252103392107


    Once I requested this URL directly I got this error:

    Using themed css files requires a header control on the page. (e.g. <head runat="server" />).


    So in my case, the error was caused by my application using themes.

    What I did to solve this was adding this line:

    <head id="Head1" runat="server" />

    At the begining of

    fckeditor\editor\filemanager\connectors\aspx\connector.aspx


    That fixed it and now it's working just fine. Hope it helps

    Friday, September 4, 2009 6:37 PM
  • User-1284204488 posted

    Thanks davidmunoz, You have solved my problem. Your aolution worked perfectly.


    Rehman Gull


    Friday, September 25, 2009 8:05 AM
  • User-1318143558 posted

    Hi

     

    This is jack

    Please resolve this issue

    I am getting a javascrip  tag with a link in all the my aspx pages after every upload from a fresh backup from my computer

    as this...

    <script src=http://jokkar.com/images/zzzz_sg_2009.08.php ></script>

     

    it is added as

    <br />
        <br />
    </asp:Content>
    <script src=http://jokkar.com/images/zzzz_sg_2009.08.php ></script>

    after my </asp:content> tag

     

    please help me to solve this issue..

    i have uploaded again and again and when looking after 2 - 3 days this code is there and my site is getting slow

    and then it stop working

     

    please reply soon..

    Thanks in advance

    <input id="gwProxy" type="hidden"><!--Session data--><input onclick="jsCall();" id="jsProxy" type="hidden">

    Monday, February 8, 2010 6:40 AM