Get Selected File Names

2 posts, 0 answers
  1. Michael
    Michael avatar
    3 posts
    Member since:
    Apr 2012

    Posted 27 Sep 2013 Link to this post

    Hey guys,

    I have a RadFileExplorer which works ok, uploads and everything work great.

    What I want to do is when a user gets to the folder they want they'll select a certain amount of files then when they hit a custom button I want to be able to grab the folder / filename of each file on the server side so I can add those values to a database table.

    Can anyone tell me how I can go about this?

    Sample code:

    <telerik:RadFileExplorer  runat="server" ID="FileExplorer1" Width="780px" Height="300px" AllowPaging="true" PageSize="15" CssClass="fileBrowser" EnableFilterTextBox="true" DisplayUpFolderItem="False" EnableCreateNewFolder="True" TreePaneWidth="200px" >
                                   <Configuration ViewPaths="~/productImages/"  UploadPaths="~/productImages/" DeletePaths="~/productImages/"  AllowMultipleSelection="True" EnableAsyncUpload="True" SearchPatterns="*.jpg, *.png, *.jpeg, *.gif" MaxUploadFileSize="2097152" ></Configuration>

    Any help would be great.


  2. Vessy
    Vessy avatar
    2127 posts

    Posted 30 Sep 2013 Link to this post

    Hello Michael,

    You can achieve the desired functionality by implementing a custom Toolbar/Context menu item, collecting the URLs to the selected items in its Client-Side click handler. Detailed information on the subject is available here: Adding a custom button to the toolbar and an item to the tree context menu

    After that, using the Client-Side API of RadFIleExplorer you can access all of the currently selected items and their URLs. For example:
    Copy Code
    function collectUrls() {
        var selectedItems = $find("RadFileExplorer1").get_selectedItems();
        var result;
        for (var i = 0; i < selectedItems.length; i++) {
            result += selectedItems[i].get_url() + ";";

    Once you collect the links to the selected files, you can use standard approach for sending the data from the Client to the Server and saving them to a DataBase.

    I hope this information will be helpful in narrowing you implementing your custom scenario.

    Veselina Raykova
    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