More in this section

Forums / General Discussions / RadEditor with Image and document Library

RadEditor with Image and document Library

3 posts, 0 answered
  1. Tarun
    Tarun avatar
    81 posts
    14 Jan 2009
    21 Aug 2010
    Link to this post

    I am using radEditor and triyng to upload a image in the particular library. Actually I am creating a library for each user and let users to upload in its library only  Is there any way to remove "change" hyper link from the sitefinity's ImageEditorDialog and fix user library through code 


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    22 Aug 2010
    Link to this post
    Hi Tarun,

    You can take a look at ImageEditorDialog default upload path

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Tarun
    Tarun avatar
    81 posts
    14 Jan 2009
    22 Aug 2010
    Link to this post
    Thank you Ivan but I made a new template and just change the image selector button path on editor. This is the custom template code

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyBusinessContentImageEditorDialogue.aspx.cs"
        Inherits="Sitefinity_UserControls_Dialogs_MyBusinessContentImageEditorDialogue" Theme="Rua-Two-Blue" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head runat="server">
        <script type="text/javascript">
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                return oWindow;
            function returnToParent() {
                var oArg = new Object();
                oArg.href = document.getElementById("txtUploadUrl").value;
                var oWnd = GetRadWindow();
        <form id="form1" runat="server">
            <asp:ScriptManager ID="s" runat="server">
            <telerik:RadUpload ID="RadUpload1" runat="server" ControlObjectsVisibility="ClearButtons"
                MaxFileInputsCount="10" EnableEmbeddedSkins="True" />
            <telerik:RadProgressArea ID="progressArea1" runat="server" Skin="Telerik">
            <telerik:RadProgressManager ID="Radprogressmanager1" runat="server" />
            <asp:Button ID="buttonSubmit" CssClass="ruButton ruClear" runat="server" OnClick="buttonSubmit_Click" Text="Upload" />
            <asp:TextBox ID="txtUploadUrl"  runat="server" Style="display: none;"></asp:TextBox>
            <img id="imgPrv" runat="server" alt="" />
        <div style="margin-top:100px;">
          <input type="button" value="Insert" id="close" class="ruButton ruClear" onclick="returnToParent(); return false;" />
          <input type="button" value="Cancel" id="Cancel" class="ruButton ruClear" onclick="returnToParent(); return false;" />

    private void BindResults()
          string username = HttpContext.Current.User.Identity.Name;
          if (RadUpload1.UploadedFiles.Count > 0)
              int imageIndex = 0;
              foreach (UploadedFile validFile in RadUpload1.UploadedFiles)
                  Telerik.Web.UI.UploadedFile firstFile = RadUpload1.UploadedFiles[imageIndex];
                  if (Mimetype(firstFile.ContentType))
                      Telerik.Libraries.LibraryManager libraryManager = new Telerik.Libraries.LibraryManager();
                      Telerik.Libraries.ILibrary parentLibrary = libraryManager.GetLibrary("UserFiles_" + username);
                      byte[] buffer = new byte[firstFile.InputStream.Length];
                      long position = 0;
                      int currentByte = firstFile.InputStream.ReadByte();
                      while (currentByte != -1)
                          buffer[position++] = (byte)currentByte;
                          currentByte = firstFile.InputStream.ReadByte();
                      Telerik.Cms.Engine.IContent content = null;
                      // upload the file    
                          content = libraryManager.UploadFile(buffer,
                          Telerik.Cms.Engine.StagedContent temp = libraryManager.GetCurrentState(content.ID) as Telerik.Cms.Engine.StagedContent;
                          temp.SetMetaData("Author", username);
                          libraryManager.SaveContent(temp, Telerik.Cms.Engine.ContentStatus.Published);
                          string domain = "http://" + HttpContext.Current.Request.ServerVariables["HTTP_HOST"];
                          string imgUrl = content.UrlWithExtension;
                          imgUrl = imgUrl.Remove(0, 1);
                          txtUploadUrl.Text = domain + imgUrl;
                          imgPrv.Src = domain + imgUrl;
                      catch (Exception ex)
                          throw ex;
                      Response.Write("Invalid image file!");

Register for webinar
3 posts, 0 answered