using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;

public partial class Default3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RadEditor1.ImageManager.ViewPaths = new string[] { "~/Images" };
        RadEditor1.ImageManager.UploadPaths = new string[] { "~/Images" };
        RadEditor1.ImageManager.DeletePaths = new string[] { "~/Images" };
        RadEditor1.ImageManager.ContentProviderTypeName = typeof(myprovider).AssemblyQualifiedName;
    }

    public class myprovider : Telerik.Web.UI.Widgets.FileSystemContentProvider
    {
        public myprovider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag)
            : base(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag)
        {
        }

        public override string StoreFile(UploadedFile file, string path, string name, params string[] arguments)
        {
            string fileExtention = name.Substring(name.LastIndexOf("."));
            string fileNameWithoutExtension = name.Substring(0, name.IndexOf("."));
            string newFileName = fileNameWithoutExtension + DateTime.UtcNow.Ticks + fileExtention;

            string result = base.StoreFile(file, path, newFileName, arguments);

            return result;
        }
    }
   
}
