FileExplorer path issue

8 posts, 0 answers
  1. Patrik Holmberg
    Patrik Holmberg avatar
    5 posts
    Member since:
    May 2007

    Posted 18 Sep 2009 Link to this post

    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
  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 23 Sep 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rob
    Rob avatar
    4 posts
    Member since:
    Oct 2007

    Posted 13 Oct 2009 Link to this post

    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
  5. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 16 Oct 2009 Link to this post

    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.
  6. Patrik Holmberg
    Patrik Holmberg avatar
    5 posts
    Member since:
    May 2007

    Posted 27 Oct 2009 Link to this post

    Hello again,

    What is the status on the Content Provider supporting FTP?

    BR,
    Cristoffer
  7. Lini
    Admin
    Lini avatar
    2144 posts

    Posted 28 Oct 2009 Link to this post

    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.
  8. Vazqusa
    Vazqusa avatar
    4 posts
    Member since:
    Aug 2013

    Posted 27 Aug 2013 Link to this post

    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 ? 
  9. Vessy
    Admin
    Vessy avatar
    1382 posts

    Posted 29 Aug 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017