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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting hostUrl to a local file path

Thread ID:





148868 Nov 6,2019 05:37 PM UTC Nov 7,2019 10:20 AM UTC JavaScript - EJ 2 1
Tags: FileManager
Asked On November 6, 2019 05:37 PM UTC

I followed the getting started document here and am left with the following:

     $(function () {
          var hostUrl = 'https://ej2services.syncfusion.com/production/web-services/';
          var filemanagerInstance = new ej.filemanager.FileManager({
               ajaxSettings: {
                    url: hostUrl + 'api/FileManager/FileOperations'

This works fine, but I went to change to a network location as such:

     $(function () {
          var hostUrl = "z:\\folder1\\folder2\\folder3";
          var filemanagerInstance = new ej.filemanager.FileManager({
               ajaxSettings: {
                    url: hostUrl

However, I get the following error:
     "NetworkError: Failed to send on XMLHTTPRequest: Failed to load z:\folder1\folder2\folder3"

I have tried setting hostUrl to a localhost url path, and tried adding file:/// to the front, but I always get this error.  Is there another way I'm supposed to use to access these folders?

Keerthana Rajendran [Syncfusion]
Replied On November 7, 2019 10:20 AM UTC

Hi William,  
Greetings from Syncfusion support. 
We have checked your reported query “setting local path for file manager component”. We sorted out the issue, the path of the file manager is not set properly. In documentation, we are using online service link for file manager component. If you have to change the root path of the file manager component, we suggest you to use the local service for file manager component. The root path of the file manager component is set from server side. 
Refer the below code snippet to set the root path. File location Controller/FileManagerController.cs 
        public PhysicalFileProvider operation; 
        public string basePath; 
        string root = "D:\\support\\controller"; 
        public FileManagerController(IHostingEnvironment hostingEnvironment) 
            // Map the path of the files to be accessed with the host 
            this.basePath = hostingEnvironment.ContentRootPath; 
            this.operation = new PhysicalFileProvider(); 
            // Assign the mapped path as root folder 
For your reference, we have attached a local service for file manager component. In that service, you have to change the root path of file manager component. 
After running the local service, the service will be launched in the specific localhost URL. Refer that local host URL in the file manager sample.  
Refer the below code snippet for specifying the local host URL. 
  var hostUrl = 'http://localhost:62869/'; 
    var fileObject = new ej.filemanager.FileManager({ 
            ajaxSettings: { 
                url: hostUrl + 'api/FileManager/FileOperations', 
                getImageUrl: hostUrl + 'api/FileManager/GetImage', 
                uploadUrl: hostUrl + 'api/FileManager/Upload', 
                downloadUrl: hostUrl + 'api/FileManager/Download'     
      view: 'Details' 
For your reference, we have prepared a sample. After running the file manager local service, refer the service URL in file manager sample. 
Please let us know, if you need any further assistance. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon