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

FileExplorer path issue

7 Answers 286 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Patrik Holmberg
Top achievements
Rank 1
Patrik Holmberg asked on 18 Sep 2009, 01:58 PM
Hello,

I'm having some problems with my directory path on RadFileExplorer. I'm trying to use the path "\\ftp\ftp\" but it won't load any files or directories, it only loads empty.

Here's some code to analyze:
<telerik:RadFileExplorer ID="FileExplorer1" runat="server" Width="700" Height="500" /


if (!IsPostBack) 
    FileExplorer1.Configuration.ContentProviderTypeName = typeof(CustomColumnsContentProvider).AssemblyQualifiedName; 
 
    FileExplorer1.InitialPath = Page.ResolveUrl(@"\\ftp\ftp\" ); 
    FileExplorer1.Configuration.DeletePaths = new string[] { @"\\ftp\ftp\" }; 
    FileExplorer1.Configuration.UploadPaths = new string[] { @"\\ftp\ftp\" }; 
    FileExplorer1.Configuration.ViewPaths = new string[] { @"\\ftp\ftp\" }; 
 
  AddDateColumns();

public class CustomColumnsContentProvider : FileSystemContentProvider 
    public CustomColumnsContentProvider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag) 
        : base(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag) 
    { 
        // Declaring a constructor is required when creating a custom content provider class 
    } 
 
    public override DirectoryItem ResolveDirectory(string path) 
    { 
        // Update all file items with the additional information (date, owner) 
        DirectoryItem oldItem = base.ResolveDirectory(path); 
 
        foreach (FileItem fileItem in oldItem.Files) 
        { 
            // Get the information from the physical file 
            FileInfo fInfo = new FileInfo(Context.Server.MapPath(VirtualPathUtility.AppendTrailingSlash(oldItem.Path) + fileItem.Name)); 
 
            // Add the information to the attributes collection of the item. It will be automatically picked up by the FileExplorer 
            // If the name attribute matches the unique name of a grid column 
 
            fileItem.Attributes.Add("Date", fInfo.CreationTime.ToString()); 
        } 
 
        return oldItem; 
    } 
 
    public override DirectoryItem ResolveRootDirectoryAsTree(string path) 
    { 
        // Update all directory items with the additional information (date, owner) 
        DirectoryItem oldItem = base.ResolveRootDirectoryAsTree(path); 
 
        foreach (DirectoryItem dirItem in oldItem.Directories) 
        { 
            // Get the information from the physical directory 
            DirectoryInfo dInfo = new DirectoryInfo(Context.Server.MapPath(VirtualPathUtility.AppendTrailingSlash(dirItem.Path))); 
 
            // Add the information to the attributes collection of the item. It will be automatically picked up by the FileExplorer 
            // If the name attribute matches the unique name of a grid column 
 
            dirItem.Attributes.Add("Date", dInfo.LastWriteTime.ToString()); 
        } 
        return oldItem; 
    } 
 
 


How come the "\\ftp\ftp\" path doesn't work?
And if I don't comment off the code:
FileExplorer1.Configuration.ContentProviderTypeName = typeof(CustomColumnsContentProvider).AssemblyQualifiedName; 

I get an error at:
DirectoryItem oldItem = base.ResolveDirectory(path); 
Saying that oldItem is null.

I don't believe there's anything wrong with the path string, because when I try the follow code:
DirectoryInfo di = new DirectoryInfo("\\ftp\ftp\"); 
 FileInfo[] rgFiles = di.GetFiles("*.*"); 
 foreach(FileInfo fi in rgFiles) 
 { 
  Response.Write("<br><a href=" + fi.Name + ">" + fi.Name + "</a>");        
 } 
I get the correct files listed on that path.

I even tried Impersonating an account before using the paths, but it still doesn't work.

I hope there's sufficient information, please help.

Thanks in advance
/Cristoffer

7 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 23 Sep 2009, 11:17 AM
Hi Cristoffer,

I have already answered  your support ticket.

Best wishes,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Rob
Top achievements
Rank 1
answered on 13 Oct 2009, 02:37 PM
Hi Fiko,

Please also advise on the forums as to the reasons / resolution,

or can we ( the public ) see other people's support tickets?

thanks
rob Zeilinga
0
Fiko
Telerik team
answered on 16 Oct 2009, 12:07 PM
Hello Rob,

This is my answer to the Cristoffer's support ticket :

"By default the RadFileExplorer works only with folders that are:
  • subdirectory of your web application
  • a directory placed in the root of IIS - you can set this folder by using the / forward slash symbol, e.g.
    RadFileExplorer1.Configuration.UploadPaths  = new String []{"/Images"};
  • a virtual directory of your web application that has a physical path pointing outside of your web application (Mapping)
In the example code you use base.ResolveDirectory(path) and this cause the problem, because the base class (the FileSystemContentProvider is the default provider used in the RadFileExplorer) works with virtual paths only. In your project, however, you need to access files/folders by its FTP path and in this case you need to implement your custom logic to retrieve, store, delete etc. these files. More details on the subject can be found in this help page. Also I recommend you check this KB article as well."


Additionally, I would like to inform you that we plan to implement a content provider next week that will allow the FileExplorer to be connected to FTP folders. The solution will be available in the code library section of the control.

I hope this helps.

Greetings,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Patrik Holmberg
Top achievements
Rank 1
answered on 27 Oct 2009, 01:24 PM
Hello again,

What is the status on the Content Provider supporting FTP?

BR,
Cristoffer
0
Lini
Telerik team
answered on 28 Oct 2009, 07:50 AM
Hi Cristoffer,

The provider is available for download now as part of the following KB article - http://www.telerik.com/support/kb/aspnet-ajax/fileexplorer/ftpcontentprovider.aspx

Kind regards,
Lini
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Vazqusa
Top achievements
Rank 1
answered on 27 Aug 2013, 06:38 PM
Hello, i'm new in the forum, but right now i'm having a problem with the ImageManager on the preview, this is happening just with images that contains special characters like "%, &, $", so the image is there in the root path, but the preview is just not working, i tried to rename the image for the control pointing to the original image, but still the same, so is there any solution for this ? 
0
Vessy
Telerik team
answered on 29 Aug 2013, 02:43 PM
Hi Vazqusa,

I have just answered your other forum thread on the subject - please, refer it here.

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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
FileExplorer
Asked by
Patrik Holmberg
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Rob
Top achievements
Rank 1
Patrik Holmberg
Top achievements
Rank 1
Lini
Telerik team
Vazqusa
Top achievements
Rank 1
Vessy
Telerik team
Share this question
or