This is a migrated thread and some comments may be shown as answers.

FileExplorer Path Issue

4 Answers 105 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Prasanth100
Top achievements
Rank 1
Prasanth100 asked on 27 Feb 2014, 12:23 PM
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

4 Answers, 1 is accepted

Sort by
0
Accepted
Vessy
Telerik team
answered on 27 Feb 2014, 02:33 PM
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.
0
Prasanth100
Top achievements
Rank 1
answered on 27 Feb 2014, 02:36 PM
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















0
Prasanth100
Top achievements
Rank 1
answered on 27 Feb 2014, 05:29 PM
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
0
Accepted
Vessy
Telerik team
answered on 03 Mar 2014, 02:07 PM
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.
Tags
FileExplorer
Asked by
Prasanth100
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Prasanth100
Top achievements
Rank 1
Share this question
or