+1-888-365-2779
Try Now
More in this section

Forums / Set-up & Installation / uploading file with RadEditor

uploading file with RadEditor

10 posts, 0 answered
  1. mexner
    mexner avatar
    98 posts
    Registered:
    06 Apr 2006
    03 Apr 2008
    Link to this post
    I've modified the EditorToolsFile.xml for the Generic content editor so that I may have a document manager button. I've found that I can edit the properties of the document manager by editing the file
    ~/Sitefinity/Admin/Generic_Content/EditorTemplate.ascx

    <telerik:RadEditor  
        runat="server" 
        ID="RadEditor1" 
        ToolsFile="~/Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml" 
        ContentAreaCssFile="~/Sitefinity/Admin/Themes/Default/Prometheus/Default2006/EditorContentArea.css" 
        Skin="Default2006" 
        NewLineBr="false" 
        Height="360px"  
        Width="98%"
        <ImageManager ViewPaths="~/Images" UploadPaths="~/Images" DeletePaths="~/Images" /> 
        <MediaManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" /> 
        <FlashManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" /> 
        <DocumentManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" MaxUploadFileSize="10485760" /> 
        <CssFiles> 
            <telerik:EditorCssFile Value="~/Sitefinity/Admin/Themes/Default/Prometheus/Default2006/EditorCssFile.css" /> 
        </CssFiles> 


    I've been able to successfully increase my max file upload size, however I'm having a problem of "WHERE" the file is uploaded to.  Per my settings above, the file should be uploaded to ~/Files. That is not the case, it is being uploaded to the root folder,inline with the Global.asax and Default.aspx pages.

    Is this a known bug? Any recomendations?
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    08 Dec 2016
    04 Apr 2008
    Link to this post
    Hi CHRIS,

    Unfortunately, we can not reproduce the described behavior. Please note that by default the Generic Content control uses Library Document Manager that is provided by Sitefinity v3.2. In this case, the uploaded documents are stored in the project database and not in the file system. However, you can enable RadEditor's built-in functionality for inserting files by modifying ~/Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml file. You should change the name attribute of the tool section from LibraryDocumentManager to DocumentManager:

    <tools name="InsertToolbar" dockable="false"
        <tool name="LibraryImageManager" text="Insert an image"/> 
        <tool name="DocumentManager" text="Insert a document"/> 

    Hope this helps.

    All the best,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Justin
    Justin avatar
    16 posts
    Registered:
    21 Oct 2007
    11 May 2008
    Link to this post
    I did not see a follow up response for this and I am having the same problem on my 3.2 site with the dialog manager where the images are uploaded to the root of the web site instead of the designated folder.  The code to initialize the dialog (from Page_Load) is below.

    One thing to note here-- this problem occurs on the web site I have deployed at my ISP.  This problem does not seem to occur on my development machine running in the debugger.

    From Page_Load() in the code behind:

                FileManagerDialogParameters dialogParameters = new FileManagerDialogParameters();  
                dialogParameters.ViewPaths = new string[] { Page.ResolveUrl("~/Images/Students/DCA")};  
                dialogParameters.UploadPaths = new string[] { Page.ResolveUrl("~/Images/Students/DCA") };  
                //dialogParameters.UploadPaths = new string[] { "~/images/" };  
                dialogParameters.DeletePaths = new string[] { Page.ResolveUrl("~/Images/Students/DCA") };  
                dialogParameters.MaxUploadFileSize = 5000000;  
     
     
                // If you don't set the following property, the default value will be used  
                // dialogParameters.SearchPatterns = new string[] { "*.jpg" };  
     
                DialogDefinition imageManager = new DialogDefinition(typeof(ImageManagerDialog), dialogParameters);  
                imageManager.ClientCallbackFunction = "ImageManagerFunction";  
                imageManager.Width = Unit.Pixel(694);  
                imageManager.Height = Unit.Pixel(440);  
     
                DialogOpener1.DialogDefinitions.Add("ImageManager", imageManager);  
     

    and here's the code from the .aspx:

                    <telerik:dialogopener runat="server" id="DialogOpener1"></telerik:dialogopener> 
     
                    <input onclick="$find('<%= DialogOpener1.ClientID %>').open('ImageManager');" type="button" value="Select/Upload Image" />   
     

    Everything works great except the images are uploaded to the root of the website instead of the location designated in UploadPaths.  I'm sure it's something simple I missed.

    Thanks,
    Justin
  4. Pepi
    Pepi avatar
    981 posts
    Registered:
    08 Dec 2016
    12 May 2008
    Link to this post
    Hello Justin,

    If I understand correctly, you are trying to use Image Manager outside RadEditor. You can find information how to show any *Manager dialog without RadEditor in the following forum thread: Client-Side Methods.

    Also, try setting the
    UploadPaths property as follows and check if the problem still persists:

    protected void Page_Load(object sender, EventArgs e) 
        { 
          FileManagerDialogParameters dialogParameters = new FileManagerDialogParameters(); 
          dialogParameters.ViewPaths = new string[] { "~/Images/Students/DCA" }; 
          dialogParameters.UploadPaths = new string[] { "~/Images/Students/DCA" }; 
          dialogParameters.DeletePaths = new string[] { "~/Images/Students/DCA" }; 
          dialogParameters.MaxUploadFileSize = 5000000; 
          ... 

    Do let us know about the results.

    Best wishes,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Justin
    Justin avatar
    16 posts
    Registered:
    21 Oct 2007
    13 May 2008
    Link to this post
    Hi Pepi,
    I changed the code to use what you have suggested and the files are still uploaded to the root of the web site.  I'm not sure what I'm missing for this setting.  The dialog correctly loads and displays the files in the "~/Images/Students/DCA" folder so it's finding the folder successfully but all of files are uploaded to the root of the web site, which causes problems for our users since the files are not uploaded to a location they can work with.

    Also, the link provided to the article on Client-Side Methods throws an error that the article doesn't exist.  I'll do a search for it. 

    Thanks,
    Justin
  6. Pepi
    Pepi avatar
    981 posts
    Registered:
    08 Dec 2016
    13 May 2008
    Link to this post
    Hello Justin,

    Here is the code example that is provided in the "Client-Side Methods" article:

    <div> 
             <script type="text/javascript"
             function ImageManagerFunction(sender, args) 
             { 
              var selectedItem = args.SelectedItem; 
              var resultImageObject = args.Result; 
               
              alert("You selected " + selectedItem.getPath()); 
               
              var txt = $get('<%= TextBox1.ClientID %>'); 
              txt.value = resultImageObject.pathname;; 
             } 
             </script> 
             <asp:textbox runat="server" id="TextBox1"></asp:textbox> 
             <telerik:dialogopener runat="server" id="DialogOpener1"></telerik:dialogopener> 
             <button type="button" onclick="$find('<%= DialogOpener1.ClientID %>').open('ImageManager');"
              Open ImageManager 
             </button> 
            </div> 

    code behind:
    protected void Page_Load(object sender, EventArgs e) 
        { 
            FileManagerDialogParameters dialogParameters = new FileManagerDialogParameters(); 
            dialogParameters.ViewPaths = new string[] { "~/Images" }; 
            dialogParameters.UploadPaths = new string[] { "~/Images" }; 
            dialogParameters.DeletePaths = new string[] { "~/Images" }; 
            dialogParameters.MaxUploadFileSize = 5000000; 
            // If you don't set the following property, the default value will be used 
            // dialogParameters.SearchPatterns = new string[] { "*.jpg" }; 
     
            DialogDefinition imageManager = new DialogDefinition(typeof(ImageManagerDialog), dialogParameters); 
            imageManager.ClientCallbackFunction = "ImageManagerFunction"
            imageManager.Width = Unit.Pixel(694); 
            imageManager.Height = Unit.Pixel(440); 
     
            DialogOpener1.DialogDefinitions.Add("ImageManager", imageManager); 
        } 

    If this does not help, please provide more detailed information how you use the Image Manager as a standalone control (outside RadEditor). Where did you implement the code above - on a master page or on a user control?

    Also, it will be very helpful if you give us access to the online site and explain how to test the issue.

    Thanks for your cooperation in advance.

    All the best,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. Justin
    Justin avatar
    16 posts
    Registered:
    21 Oct 2007
    13 May 2008
    Link to this post

    Hi Pepi,

    The code I implemented came directly from the Client-Side Methods article about three months ago when I first implemented it.  So the code I'm using is virtually identical to what you have posted.

    One thing I will mention again-- when I run this project on my local machine under the debugger the uploaded image file is placed in the correct folder on the web site.  This only seems to be a problem for the production site deployed on my ISP.

    This functionality is implemented in a user control and all of the code is contained in the control.  Here is the relevant snippets from the control code.

    from the .ascx, this code is right above the text box where the path to the selected file is displayed.

     <script type="text/javascript">  
         function ImageManagerFunction(sender, args)  
         {  
            var selectedItem = args.SelectedItem;  
            var resultImageObject = args.Result;  
            var txt = $get('<%= ctrlImagePath.ClientID %>');  
            txt.value = selectedItem.getPath(); //resultImageObject.outerHTML;  
     
            var img = document.getElementById('<%= imgPhoto.ClientID %>')  
            img.src = selectedItem.getPath();   
         }  
     </script> 
     

     

    from the .ascx.cs file:

            protected void Page_Load(object sender, EventArgs e)   
            {  
                FileManagerDialogParameters dialogParameters = new FileManagerDialogParameters();  
                //dialogParameters.ViewPaths = new string[] { Page.ResolveUrl("~/Images/Students/DCA")};  
                //dialogParameters.UploadPaths = new string[] { Page.ResolveUrl("~/Images/Students/DCA") };  
                //dialogParameters.DeletePaths = new string[] { Page.ResolveUrl("~/Images/Students/DCA") };  
                dialogParameters.ViewPaths = new string[] { "~/Images/Students/DCA" };  
                dialogParameters.UploadPaths = new string[] { "~/Images/Students/DCA" };  
                dialogParameters.DeletePaths = new string[] { "~/Images/Students/DCA" };  
                dialogParameters.MaxUploadFileSize = 5000000;  
     
     
                // If you don't set the following property, the default value will be used  
                // dialogParameters.SearchPatterns = new string[] { "*.jpg" };  
     
                DialogDefinition imageManager = new DialogDefinition(typeof(ImageManagerDialog), dialogParameters);  
                imageManager.ClientCallbackFunction = "ImageManagerFunction";  
                imageManager.Width = Unit.Pixel(694);  
                imageManager.Height = Unit.Pixel(440);  
     
                DialogOpener1.DialogDefinitions.Add("ImageManager", imageManager);  
     
     

    If this info does not help then we can work to get you access to the production site.

    Thanks for your help!
    Justin

  8. Pepi
    Pepi avatar
    981 posts
    Registered:
    08 Dec 2016
    14 May 2008
    Link to this post
    Hello Justin,

    We talked with our RadEditor team and they said that the described behavior is a bug with the RadEditor version 2007.3.1425.20. The problem is already fixed in the current official release of RadControls for ASP.NET AJAX (version 2008.1.415.20). We have plans to include the latest version of RadControls in Sitefinity for the upcoming Service Pack at the end of the month.

    We are sorry for the inconvenience caused.

    Best wishes,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  9. Justin
    Justin avatar
    16 posts
    Registered:
    21 Oct 2007
    14 May 2008
    Link to this post
    We should be able to wait until the end of the month for the service pack.  If the service pack is delayed or we need to get this working before the end of the month would you recommend upgradring the RadControls directly with 2008.1.415.20?  I also own the RadControls so I believe that would be an option.

    Thanks,
    Justin
  10. Nikifor
    Nikifor avatar
    232 posts
    Registered:
    18 May 2013
    16 May 2008
    Link to this post
    Hi Justin,

    If you need to use the newest RadControls, you could always swap the Telerik.Web.UI.dll file stored in the bin folder with the one with version 2008.1.415.20. In this way you will be able to run the latest available version of the Telerik's RadControls. It would be necessary to add assembly binding in the web.config so that you can make the swap legal. The highlighted part from the snippet is the one which should be added:

     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
            <dependentAssembly> 
              <assemblyIdentity name="Telerik.Web.UI" 
                                publicKeyToken="121fae78165ba3d4" 
                                culture="neutral" /> 
              <bindingRedirect oldVersion="2007.3.1425.20" 
                               newVersion="2008.1.415.20"/> 
            </dependentAssembly> 
    ........ 

    Nevertheless, we recommend you to wait until Sitefinity Service Pack 2 release is available. It will include the newest versions of RadControls that are not released yet.

    Hope that the information is helpful.

    All the best,
    Nikifor
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
10 posts, 0 answered