We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to get the path of selected file in File Manager

Hi,

I would like to know how can I retrieve the path of selected item in File Manager. And in addition to that is it possible to provide an example on how to use file operations mentioned in the below article

https://ej2.syncfusion.com/aspnetmvc/documentation/file-manager/file-operations


1 Reply

SS Sivakumar ShunmugaSundaram Syncfusion Team October 27, 2022 05:40 AM

Hi Madan,


Greetings from syncfusion support.


From the shared details, we understand that you want to get the file path while selecting files in the FileManager component. We have prepared a simple sample of the ASP.NET MVC FileManager component and got the path of the selected files using the FileManager FileSelect event. To achieve your requirement, we suggest you use the below code snippet in the FileManager FileSelect event. We have attached the prepared sample for your reference.


Refer to the below code snippet.

[Index.cshtml]

 

        <!-- Declare filemanager element -->

        @Html.EJS().FileManager("filemanager").AjaxSettings(new Syncfusion.EJ2.FileManager.FileManagerAjaxSettings

   {

...

   }).FileSelect("onFileSelection").View(Syncfusion.EJ2.FileManager.ViewType.Details).Render()

        <!-- end of filemanager element -->

    </div>

</div>

<script>

    function onFileSelection(args) {

      //Here you can get the path of selected file

        console.log(args.fileDetails.filterPath);

    }

</script>


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/WebApplication1525305888.zip


Also, we have attached the documentation of the user interface which explains the FileManager operation for your reference.


Documentation: https://ej2.syncfusion.com/aspnetmvc/documentation/file-manager/user-interface


Please check the shared details and get back to us if you need any further assistance.


Regards,

Sivakumar S


Loader.
Live Chat Icon For mobile
Up arrow icon