FileExplorer Path Issue

5 posts, 2 answers
  1. Prasanth100
    Prasanth100 avatar
    17 posts
    Member since:
    Oct 2012

    Posted 27 Feb 2014 Link to this post

    Hello Gurus,

    I am giving Path Dynamically, i am getting the following exception:
     
     'C:/TestApplication.WebApp/UserWebDrive/acd8e7a9-1454-43d8-9679-272969ee317c/Images' is a physical path, but a virtual path was expected.

     here is the code i am using:
     -------------------------------------
     
     <telerik:RadFileExplorer runat="server" ID="FileExplorer1" Width="520px" Height="520px"
    OnClientItemSelected="OnClientItemSelected" AllowPaging="true" PageSize="10">

       </telerik:RadFileExplorer>
     
     
                string Path = Server.MapPath("~/MagicWebDrive/" + UserID);
                string[] arrFiles = System.IO.Directory.GetDirectories(Path); 
                for (int i = 0; i < arrFiles.Length; i++)
                {
                    FileExplorer1.Configuration.ViewPaths = arrFiles.ToArray();
                    FileExplorer1.Configuration.DeletePaths = arrFiles.ToArray();
                    FileExplorer1.Configuration.UploadPaths = arrFiles.ToArray();
                }

    Thanks in Advance
  2. Answer
    Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 27 Feb 2014 Link to this post

    Hi Prasanth,

    The Server.MapPath() method  returns the physical path corresponding to the passed virtual one, while RadFileExplorer works directly with the virtual paths. You can use a similar logic in order to avoid this issue:
    string Path =  Server.MapPath("~/MagicWebDrive/" + UserID);
    string root = "~/MagicWebDrive/" + UserID + "/";
    string[] arrFiles = System.IO.Directory.GetDirectories(Path);
    string[] folders = new string[arrFiles.Length];
     
    for (int i = 0; i < arrFiles.Length; i++)
    {
        folders[i] = root + arrFiles[i].Substring(arrFiles[i].LastIndexOf(@"\") + 1);
    }
     
    FileExplorer1.Configuration.ViewPaths = folders.ToArray();
    FileExplorer1.Configuration.DeletePaths = folders.ToArray();
    FileExplorer1.Configuration.UploadPaths = folders.ToArray();

    I hope this helps.

    Regards,
    Veselina Raykova
    Telerik
    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 UI for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Prasanth100
    Prasanth100 avatar
    17 posts
    Member since:
    Oct 2012

    Posted 27 Feb 2014 in reply to Prasanth100 Link to this post

    Hi,
      I resolved the issue by adding 
    string[] paths = new string[] { "~/" };

      for (int i = 0; i < arrFiles.Length; i++)
                {
                   string[] paths = new string[] { "~/" };
                    FileExplorer1.Configuration.ViewPaths = arrFiles.ToArray();
                    FileExplorer1.Configuration.DeletePaths = arrFiles.ToArray();
                    FileExplorer1.Configuration.UploadPaths = arrFiles.ToArray();
                }

    How to get the folder name alone in the address bar of RadFileExplorer
    TestApplication.Web/UserWebDrive/07bdf9d4-c156-4e58-a686-28e333136619/Images

    now i want only the following
    07bdf9d4-c156-4e58-a686-28e333136619/Images

    how to achieve this.

    Thanks in Advance















  5. Prasanth100
    Prasanth100 avatar
    17 posts
    Member since:
    Oct 2012

    Posted 27 Feb 2014 in reply to Prasanth100 Link to this post

    Hello Veselina Raykova,

     Thanks your reply,that solved my issue.
     
    I got another scenario: 
    How to get the folder name in the address bar of RadFileExplorer instead of full path name:
    eg : The following is the full path name :
    TestApplication.Web/UserWebDrive/07bdf9d4-c156-4e58-a686-28e333136619/Images

    now i want only the following folder:
    07bdf9d4-c156-4e58-a686-28e333136619/Images

    how to achieve this.

    Thanks in Advance
  6. Answer
    Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 03 Mar 2014 Link to this post

    Hi Prasanth,

    You could achieve the desired scenario using on of the following approaches:
    • You can implement a mapping like the one used in this KB article, so you will be able to configure a custom name for the root folder
    • You can hide the AddressBar at all by excluding it from the FileExplorer's VisibleControl's property:
      <telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" VisibleControls="ContextMenus,FileList,FileList,Grid,ListView,Toolbar,TreeView">
          <Configuration ViewPaths="~/" DeletePaths="~/" UploadPaths="~/" />
      </telerik:RadFileExplorer>

    Kind regards,
    Veselina Raykova
    Telerik
    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 UI for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017