-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Disable real file path from being shown
This is a replacement for for the FileURL
option in the 1.x (old version). This option will disable any associations with your real file path and mask it with the connector.php script. Instead of example/path/file.jpg link being shown to client, they will get connector.php?cmd=file&target=whateverhashtofilepath.
Example:
<?php
$opts = array(
// 'debug' => true,
'roots' => array(
array(
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
'path' => '../files/', // path to files (REQUIRED)
// root url (DISABLE IT BY COMMENTING THE FOLLOWING LINE OUT.)
// 'URL' => dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED)
'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL)
)
)
);
You might find the connector.php?cmd=file&target=whateverhashtofilepath
path a little bit messy for the user. You can clean up the path a little bit by editing your .htaccess file and setting a rewrite URL.
Example: (.htaccess file)
RewriteEngine on
RewriteBase /
#localhost.com/view/target/ (Outputs Files)
RewriteRule ^view/([A-Za-z_0-9-]+)$ connector.php?cmd=file&target=$1
NEXT, OPEN elfinder.min.js
:
Find:
(h=c.options.url,h=h+(h.indexOf("?")===-1?"?":"&")+(c.oldAPI?"cmd=open¤t="+g.phash:"cmd=file")+"&target="+g.hash)
Replace:
(h=h+(("?")===-1?"?":"")+(c.oldAPI?"cmd=open¤t="+g.phash:"view/")+g.hash)
With the .htaccess option, users will be able to see the url as localhost.com/view/targethash/
when they open a file, instead of the choppy and complicated connector.php?cmd=file&target=targethash