Access RadFileExplorer Files with C#

4 posts, 1 answers
  1. Robert
    Robert  avatar
    68 posts
    Member since:
    Feb 2009

    Posted 14 Dec 2011 Link to this post

    I'm writing to ask how best to read folders and/or files from a populated RadFileExplorer control, programmatically with C#;

    Each day, date sensitive .pdf and .xls files are uploaded, via the RadFileExplorer;  On subsequent days, the previous days .pdf and .xls are manually moved to an Archive folder - also contained in the RadFileExplorer;  

    The objective is to eliminate the manual process of moving files, and programmatically accomplish the same task;     

    Any insight is appreciated;  Best regards - Rob

    <telerik:RadFileExplorer ID="RadFileExplorer1" Runat="server" Width="100%" OnClientItemSelected="OnClientItemSelected"
                        ExplorerMode="FileTree" 
                        OnClientLoad="OnFileExplorerLoad" 
                            VisibleControls="TreeView, Grid, Toolbar, ContextMenus" 
                        TreePaneWidth="100%" BorderColor="Transparent" BorderStyle="None" 
                        EnableCopy="True" Height="600px" >
                        <Configuration ViewPaths="~/Customers" UploadPaths="~/Customers/"
                            DeletePaths="~/Customers/" MaxUploadFileSize="2147483647" />
                    </telerik:RadFileExplorer>
  2. Answer
    Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 16 Dec 2011 Link to this post

    Hi Robert ,

    You can use RadFileExplorer's ExplorerPopulated server-side event to access and manipulate the files and folders loaded in the control. Please find more detailed information regarding RadFileExplorer's server-side events in the following help article:
    Server-side events

    However, I believe the best approach for solving this case will be to create a ScheduledTask on the server to copy the files in the archive folder.
    http://technet.microsoft.com/en-us/library/cc758861%28WS.10%29.aspx

    All the best,
    Dobromir
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sukhbinder
    Sukhbinder avatar
    7 posts
    Member since:
    May 2012

    Posted 11 May 2012 Link to this post

    Hi Telerik Team,

    I have been facing an issue with the RadFileExplorer - need to access the files being uploaded so that can do such things like renaming etc before its being saved into the specified folder.

    Thanks in advance.

    Regards
    SS Bhogal
  5. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 14 May 2012 Link to this post

    Hi Sukhbinder,

    In order to access the uploaded file to rename it, you need to subclass RadFileExplorer's FileSystemContentProvider class and override its StoreFile() method. More detailed information on how to subclass the content provider is available in the following help article:
    Using custom FileBrowserContentProvider

    Also, you can find an example for renaming the uploaded files in the following KB article:
    Giving the uploaded files unique names

    Regards,
    Dobromir
    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.
Back to Top