halgatewood / file-directory-list

Free Super Clean PHP File Directory Listing Script
https://halgatewood.com/free/file-directory-list/
360 stars 151 forks source link

changing $path to a user sub-directory isnt working #25

Open bchase-woot opened 4 years ago

bchase-woot commented 4 years ago

I have tested multiple ways to list the files in a users sub-directory with no change...

I have tried defining the $path variable at the top of the file and commenting out the included $path definition: define('path', '/home/bob/backups'); as well as define('$path', '/home/bob/backups');

I have also tried using the $items definitions as well: $items = scandir( dirname(FILE) . '/home/bob/backups' );

Still no luck. Any assistance would be greatly appreciated

halgatewood commented 4 years ago

The dirname is relative to where your php file is located. So if your index.php is in the home folder then you would just need to do this:

$items = scandir( dirname(__FILE__) . '/bob/backups' );

bchase-woot commented 4 years ago

Got it. 2 last questions. Is there anyway to remove the ability to download (already turned off force_download option), but not even allow "right click - save target as". Alternately, is there anyway to force clicking to open in a new tab as opposed to allowing download (such as for log files that simply need reviewing but not downloading)?

halgatewood commented 4 years ago

For the right-clicking you will need to add that yourself with a script: https://www.infradox.com/disable-right-clicking-dragging-images/

For opening in a new tab, look at like 184: $rtn .= "<a href=\"$file\" class=\"$file_ext\"{$download_att}>";

And change it to: $rtn .= "<a href=\"$file\" class=\"$file_ext\"{$download_att} target=\"_blank\">";

arifebayraktar commented 3 years ago

Is there a way to list a directory content which out of php folder. I have video files on my attached storage and have to list them.