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

Get Selected File Names

1 Answer 203 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 27 Sep 2013, 01:06 PM
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>
                                
                           </telerik:RadFileExplorer>

Any help would be great.

Thanks,

Michael

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 30 Sep 2013, 10:51 AM
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.

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
Michael
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or