Search code examples
phpjqueryelfinder

Mapping a drive in elfinder inside files folder


  1. Here I am mapping D drive in elfinder
  2. I am not able to open files.

Here's my code.

$opts = array(
        // 'debug' => true,
        'roots' => array(
            array(
                'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
                'path'          => 'D:/pdf/', // path to files (REQUIRED)
                'URL'           => 'D:/pdf/',  // URL to files (REQUIRED)
                'accessControl' => 'access'    // disable and hide dot starting files (OPTIONAL)
            )
        )
    );

Solution

  • Normally browser will open only url not path. We have to convert path into url.

    If you want to map a drive (D drive) create a virtual directory in XAMMP. Add below code in httpd-vhosts.conf

    <VirtualHost *:80>
       <Directory "D:/pdf">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Order Deny,Allow
        Allow from all
        Require all granted
      </Directory>
       ServerAdmin anbu@local.dev
       DocumentRoot "D:/pdf"
       ServerName local.dev
    </VirtualHost>
    

    Now restart your server.

    modify url in blow code

    $opts = array(
        // 'debug' => true,
        'roots' => array(
            array(
                'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
                'path'          => 'D:/pdf/', // path to files (REQUIRED)
                'URL'           => 'http://local.dev',  // URL to files (REQUIRED)
                'accessControl' => 'access'    // disable and hide dot starting files (OPTIONAL)
            )
        )
    );
    

    hope it will work :)