Any thoughts on handling users who insist on using & in the filename which results in a Bad Request error in FileExplorer?

2 posts, 0 answers
  1. Karl Wilkens
    Karl Wilkens avatar
    206 posts
    Member since:
    Oct 2012

    Posted 10 Apr 2013 Link to this post


    We have users who are fond of uploading files named like this - 


    The ampersand kills any ability to download the file and we get a Bad Request error. Is there any flag in the file explorer that would handle this scenario and encode the names and allow download without error? Thanks.
  2. Vessy
    Vessy avatar
    1350 posts

    Posted 15 Apr 2013 Link to this post

    Hi Karl,

    This is an expected behavior because the "%" sign is one of the reserved symbols and I would recommend you to use one of the following approaches:
    • check whether the user is trying to upload a file, containing a restricted symbol and cancel the upload in such case. More information is available here - How to notify the user that an image with invalid file name is being uploaded .For your convenience I am attaching a sample project, including also the way to achieve it with enabled AsyncUpload.
    • check whether the user is trying to upload a file, by overriding the default FileSystemContentProvider's StoreMethod() and directly replace the undesired symbols in the fileName. For example:
      public override string StoreFile(Telerik.Web.UI.UploadedFile file, string path, string name, params string[] arguments)
          name = name.Replace('%', '_');
          return base.StoreFile(file, path, name, arguments);

    I hope this information would be helpful for you.

    Veselina Raykova
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top