overrides not being hit

2 posts, 0 answers
  1. Nick Wood
    Nick Wood avatar
    126 posts
    Member since:
    Feb 2010

    Posted 14 Jan 2016 Link to this post

    Hi All

    I amusing the RadUploadHandler and overriding certain methods in my .ahsx file but these methods never seem to be hit.

    In the below code no file names are changed, no new directories are created. The file is still uploaded to the root of the target directory fine, but same filename as source.

    public class DocumentRequiredUploadHandle : RadUploadHandler
            private string newFileName = string.Empty;
            //Upload Parameters
            private string OppId = string.Empty;
            private string ClientName = string.Empty;
            private string FileNamePrefix = string.Empty;
            private string DirLoc = string.Empty;
            public override Dictionary<string, object> GetAssociatedData()
                Dictionary<string, object> dict = base.GetAssociatedData();
                if (!string.IsNullOrEmpty(newFileName))
                    dict.Add("NewFileLocation", this.newFileName);
                return dict;
            public override bool SaveChunkData(string filePath, long position, byte[] buffer, int contentLength, out int savedBytes)
                return base.SaveChunkData(filePath, position, buffer, contentLength, out savedBytes);
            public override string GetFilePath(string fileName)
                OppId = this.GetQueryParameter("OppId");
                ClientName = this.GetQueryParameter("ClientName");
                FileNamePrefix = this.GetQueryParameter("FileNamePrefix");
                DirLoc = this.TargetPhysicalFolder + @"\" + OppId;
                if (!Directory.Exists(DirLoc))
                string FilePath = string.Format(@"{0}\{1}", DirLoc, this.GetFileName(fileName));
                return FilePath;
            private string GetFileName(string fileName)
                if (this.IsNewFileRequest())
                    this.ResultChunkTag = string.Format("{0} {1} {2}", FileNamePrefix, ClientName, DateTime.Now.ToString("yyyyMMdd_hhmmss"));
                else if (this.FormChunkTag != null)
                    this.ResultChunkTag = this.FormChunkTag;
                if (this.ResultChunkTag != null)
                    int i = fileName.LastIndexOf('.');
                    if (i >= 0)
                        fileName = string.Format("{0}.{1}", this.ResultChunkTag, fileName.Substring(i + 1));
                return this.newFileName = fileName;


    Nick wood

  2. Martin Ivanov
    Martin Ivanov avatar
    1442 posts

    Posted 18 Jan 2016 Link to this post

    Hi Nick,

    I tested the code of the handler from your last reply but I wasn't able to reproduce the described issue. All the overridden methods are called as expected. You can try the following to resolve this:
    • Close Visual Studio. Manually delete the bin and obj folders of the projects which contains the RadUpload control. Then open VS and Clean, and Rebuild the solution. This should clear all cached files.
    • Create a new project with RadUpload and the same handler, and see if the issue still appears.

    I hope this helps.

    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 Feedback Portal and vote to affect the priority of the items
Back to Top