PHP Directory Listing Script

10 August, 2016

Back in 2008 we created the original version of our popular directory listing script. Since then we’ve released three new versions, addressing a number of known issues. In 2015 we completely rebuilt the script from scratch, introducing some handy new features and improvements.

The PHP Directory Listing Script is a highly configurable script, allowing you to simply upload one file into a web-accessible directory, and it’ll be turned into a well formatted, mobile friendly directory browser.

With the release of version 4, we’ve got some great new features, including:

  • Full mobile browser support.
  • The ability to upload multiple files and restrict the allowed file-types.
  • Support for restricting access to the script by either password or IP Address whitelisting (ideal if you want only yourself and clients to have access!).
  • Support for creating new directories and sub-directories.
  • Upload zip files and extract them automatically, with the option to delete the zip file after it’s been extracted.
  • Optionally hide certain file types, names or extensions, as well as directories.
  • Sort file listings by name, size or last modified date.

Finally, the last feature is that the Directory Listing Script now runs as a single file, weighing in at less than 400kb. This means the script runs faster, and is extremely easy to use!

All of the new features can be enabled and disabled individually, so whether you’re looking for a full file manager, or a simple list of downloads, the PHP Directory Listing script has you covered.

System Requirements

To run the PHP Directory Listing Script on your website, you’ll need to be running PHP 5.3 or above and have the GD2 library installed. If you wish to enable the unzip support, you’ll also need the ZipArchive php extension installed.

Download

To download the script please click here. The ZIP file contains all you need to run the script. To setup the script please see the top of index.php.

DOWNLOAD ZIP

Installation

To install the PHP Directory Listing Script, simply extract the zip file and open up the index.php file. Inside you’ll see a number of options that you can alter. Once you’ve set your options, simply upload the file into your directory and then browse to it from the web. You should now be up and running!

Future

We’re always open to feedback for improvements and suggestions so please leave any ideas in the comments section below and we’ll do our best to incorporate them into a future update.

Written by Ash

Having co-founded Evoluted in 2006, Ash’s passion for the digital world and obsession with client satisfaction has since helped the company grow into one of Yorkshire’s leading digital agencies. An advocate of ROI-focused delivery and a firm believer in the use of bespoke technology, he was nominated for ‘Business Person of the Year’ at the 2017 Sheffield Business Awards.

Up next…
Drumroll, Please
10 August, 2016

191 Comments

Callum
16th October 2017 at 9:16am

Just stumbled across this script, its great. Thank you very much!

Post reply
Martin
16th October 2017 at 9:16am

Thanks very much :)

Post reply
cahboy
16th October 2017 at 9:16am

Very nice script and so useful thanks for sharing.

Post reply
Mohammad Mirzaei
16th October 2017 at 9:16am

Thanks much! Very usefull script!

Post reply
McFire
16th October 2017 at 9:16am

Yeah - thats it!!!
Uploaded |dlf| and the index.php and - it works! Also in the last corner of my site!
The only thing I miss : I'd like to store the content of the actual shown dir/subdir into a simple text file. So I could write me a little "app" to sum the bytes of the subdir.
Or is there even planned such a count/sum function? And having it in a text it also could be helpful at work with my ftp.
Greetings and thanx for this script.

Post reply
Henrik Bechmann
16th October 2017 at 9:16am

Nice script Ash, but apparently the styles.css "#listing a strong" at line 113 needs a "white-space:nowrap" rule added to avoid a word wrap on a hyphen for a long file name. Such a wrap/break causes following formatting to get mangled.

Hope this helps.

- Henrik

Post reply
Henrik Bechmann
16th October 2017 at 9:16am

Also it appears that

overflow:hidden;
text-overflow:ellipsis;

works for listing a strong instead of truncating the filename.

- Henrik

Post reply
Ron
16th October 2017 at 9:16am

Much appreciated. The exclude list is maybe its best feature making it easy to limit a user to only the file types we want them to see. I may eventually add code to GET[..] a variable and so modify the exclusion list depending upon login.
Thank you very much for your hard work.

Post reply
Mark Jones
16th October 2017 at 9:16am

Excellent script! Thanks for the time and effort you guys put into it.

I was just wondering if anyone has worked out how to implement a delete button?

Thanks,
Jonesy

Post reply
Mark Jones
16th October 2017 at 9:16am

Figured it out!

So, to add a delete option to my file listings output I just added another link right after the file link. The href in the new link contains this php echo statement:

echo strip_tags($_SERVER['PHP_SELF']).'?deletefile='.$fileurl;

And in the same index.php file I added this php coding:

if(isset($_GET['deletefile'])){
$deletefile = $_GET['deletefile'];
unlink($deletefile);
}

I also added some additional styling to get everything lined up properly. For my specific purposes I already had security protocols in place so the DELETE link is only available to specific logged in users.

Hope this helps!

Jonesy

Post reply
Martin Clay
16th October 2017 at 9:16am

Hi guys, this script is great. It's the best one I've found so far. I'm using it to list mp3 file on my DJ site. Just one issue however, if the file name has more than one . in it , then that file is not displayed. I'm going to write a bit of code to take all .'s out of my file names but it would be good if you could consider a possible fix. Thanks again for a great free script !

Post reply
Steve Rance
16th October 2017 at 9:16am

The best solution out there, thanks Ash. Modified it for my requirements however. http://fairlightus.com/Downloads

Post reply
Scooby-2
16th October 2017 at 9:16am

Thanks for a great script. Our site is non-profit making so it's great to see a professionally written program like this made freely available.

Post reply
Toby
16th October 2017 at 9:16am

Dear Ash
Very usefull! I would like to donate, but you refused 2 years ago - If you change your mind - let me know.
Anyway - thanks a lot for this script and best wishes from Switzerland
Tobias

Post reply
helikun
16th October 2017 at 9:16am

Thank you very much.your code great.
^_^

Post reply
William Becher
16th October 2017 at 9:16am

Hi, great script. I've used this for my personal use. Can I modify the code and add some modifications to the script?

Post reply
Evoluted New Media
16th October 2017 at 9:16am

Yes, that's absolutely fine!

Post reply
Dildo P
16th October 2017 at 9:16am

Thank you very much for this!

Post reply
Jason
16th October 2017 at 9:16am

Awesome script!

Thanks for providing this.

Post reply
ratul
16th October 2017 at 9:16am

really very helpfull.... i change my www folder to a custom path just put in script and it shows the directory listing..........

thank you

Post reply
John Mosow
16th October 2017 at 9:16am

I love this new script. but I am having a problem opening files. When I click on a pdf file, I get the following:

The requested URL /Members/Index.phpDocuments/Board Meeting Minutes/2015/PLA Board Minutes - 01-2015.pdf was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Not sure why the url is incorrect for the document. My start directory is set to 'Documents' and I have tried the includeurl both ways.

Any help is appreciated.

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi John,

Looks like we had a bug there! We've just published an updated version to correct the issue. If you re-upload the index.php file from the new version and enable the includeUrl option you'll be able to fill out the URL to use as the base location.

Post reply
John Mosow
16th October 2017 at 9:16am

Rick, thanks for looking into this. I put the new php script in place and made the changes but it is not acting as I want. Off my web root, I have folders Members/Documents. I have put the script into the Members folder. Here are my settings:

public $startDirectory = 'Documents';
public $includeUrl = true;
public $directoryUrl = 'http://pinelakeassociation.com/Members/Documents';

When I click on one of the folders listed on the page, it is bringing up something completely different.

Also, I do not want anyone viewing any folders above the Documents folder. I assume I would need to put the index.php in the Documents folder.

Suggestions on what is happening and how to get what I am looking to do?

Thanks

Post reply
Muhammad Firdaus
16th October 2017 at 9:16am

Hi John Mosow, I am in the same situation as yours.
I have directory like this:
/public_html/folder/anotherfolder

I put index.php in /public_html. Because of that, user can browse to /public_html and /public_html/folder.
I want to jail user only for /public_html/folder/anotherfolder, but cant figure out how to do it.

John Mosow
16th October 2017 at 9:16am

First, I put the script in the base folder that is to be browsed. So in my case, I put the index.php in my Documents directory which has subfolders and files I want to show. Here are the settings in the script:

public $startDirectory = '.';
public $includeUrl = true;
public $directoryUrl = 'http://pinelakeassociation.com/Members/Documents/';

Now everything is working as I need it to.

FYI, I put some code in this to get the user name for my password protected directory. If they are an admin, they can do all of the folder/file maintenance. Otherwise, the user can only browse and open files.

John Mosow
16th October 2017 at 9:16am

One other item, I have my Members folder password protected but not the Documents folder. This way, they have to log in to get to the script but only need to log in once.

Rick Mills
16th October 2017 at 9:16am

Hi John,

Sorry to hear you're still having some issues.

So you want to make it so that if someone browses to yoursite.com/Members, they are presented with the directory listing script, which will show only the contents of yoursite.com/Members/Documents

One thing I did notice is your directory url - this would need to be set to the location of where the index.php file is. Links would then automatically be worked out to be inside the Documents folder as this is set on your startDirectory setting.

Other than the directoryUrl your settings do look correct. Give this change a try to see if it rectifies the issue for you. If you're still having issues after this please let me know and we can try a few other options.

John Mosow
16th October 2017 at 9:16am

I think I finally got it to work as I need it to. Just a bit more tweaking and hopefully it will all be good. Thanks for the help.

Muhammad Firdaus
16th October 2017 at 9:16am

Hi. This is a great script.
How can I make it show file size? Im viewing it on mobile and it just show me the filename.

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Muhammad,

As default we're hiding non-essential columns on mobiles as it'd cause the screen to scroll to the side on smaller screens.

You can however change this behaviour. If you open up the index.php file and search for:

class="text-right xs-hidden"

You can change this to

class="text-right"

This will make the file size show on all screen sizes. Similarly you can also remove the sm-hidden from the last modified column to show that on small screens.

Post reply
Muhammad Firdaus
16th October 2017 at 9:16am

Any user that can access that script can browse to all dir in system. Just type something like dir=/home, then they can see all home dir..
Can you make it limited only to specified dir?
like if I set dir to /home/test/dir, they cannot go to /home/test, or to /home

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Muhammad,

We've just released an update (4.0.3) that'll correct this, along with a few other issues - many thanks for letting us know!

Post reply
Anders Skjoldebrand
16th October 2017 at 9:16am

Hi Rick,

This is really a fantastic script and a very nice upgrade from version 3.

Questions:
How can we tell which version is out there to be downloaded?
I can tell my currently downloaded version is 4., nov 11 2015.
Then I also see version 4.0.3 being mentioned in your post on the same date?

I also noticed the the VIEWPORT arguments produces an error - not being recognized since they were separated by ";" instead of ",". I use OS X Safari.

Would it make sense to also include a default setting or placement in the code for the "date_default_timezone_set" since servers tend to complain.

Also a nice addition would be to have ( "UTF-8" in my case ) placed in the code. This would make it easier to remember.

Anders

Post reply
Anders Skjoldebrand
16th October 2017 at 9:16am

Rick,
There appears to be no need for the charset option since UTF-8 is supposedly default in HTML5 and that seems to work correctly. My mistake!

However, I stumbled over filenames starting with e.g.

Ö 214 00D6 Ö LATIN CAPITAL LETTER O WITH DIAERESIS
Å 197 00C5 Å LATIN CAPITAL LETTER A WITH RING ABOVE
Ä 196 00C4 Ä LATIN CAPITAL LETTER A WITH DIAERESIS

These are all typical Swedish characters.
These filenames show up in the listing WITHOUT the starting character and are also not found when clicked upon. (404 not Found)

If the same character ( upper or lower case) appears anywhere else in the file name it works fine.

Any suggestions why this happens?

Tested with Safari, Firefox and Chrome.
PHP is 5.6.16

Anders

Muhammad Firdaus
16th October 2017 at 9:16am

Thanks a lot for this!!

Post reply
John Mosow
16th October 2017 at 9:16am

I would like to split the script out to make it easier to manage. For example, I would split the user settings into one file and the sections with the image coding into another. This would make it 1) easier to implement new versions of the script without having to reenter my custom settings and 2) make it easier to use with online editors. The script is so large that my online editors have a tough time with this. Any suggestions on how to do this or would you be willing to split it up as part of your standard package?

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi John,

That's an interesting idea. The script was originally designed to be compact so that you could just drop a single file into a directory and be ready to go.

Offering an 'advanced' version that's split out may be something we can look at for a future update.

If you'd like to attempt it yourself, the first thing I'd do is move the DirectoryListing php class at the top of the file into it's own php file. Then including it into the index file.

You could then also move the CSS and Javascript out into their own files. This'd leave you with a fairly small index file.

Alternatively, if its just the settings you'd like to move out, simply create a new php file (say 'settings.php') and create an array of your settings inside it. Then include this file at the top of the index.php file, and update the variables to retrieve the values from your settings file.

So if you had an array that had, for example:

$settings = array(
'startDirectory' => 'files'
);

In the index file you'd update $startDirectory to be:

$startDirectory = $settings['startDirectory'];

Remembering to include the settings file at the top with:
include('./settings.php');

Post reply
Eric
16th October 2017 at 9:16am

I've been using this script for many years. I also needed to split the script so I could support multiple client folders with one install.
At the time, I moved the dlf folder up one directory and divided the index file in 3 sections:
- index.php: contained settings info, one copy in each client folder.
- access.php: (stored in the dlf directory) contained the password-protected restrictions I added, since that was not part of the script at the time.
- engine.php: (stored in the dlf directory) contained all the magic

I had to do some tweaks for the paths to be found, but it was straightforward. This allowed me to easily add a new client folder, copy the index.php file and adjust the settings for that specific client.

I'll try to do the same to the new version and I'll be happy to share it with you.

Post reply
John Mosow
16th October 2017 at 9:16am

I would like to change the color of the font in the directory listing but cannot seem to find where it is. Any help would be appreciated.

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi John,

The script's using a bootstrap theme called 'Yeti' hosted at bootstrapcdn.com

You can either change the URL to another bootstrap theme, or if you'd prefer to manually override the text colour, add your own CSS at the bottom of the page just before the tag.

If you wanted to for example change the link colour, adding this will change it to red:

a { color: #ff0000; }

If you're unsure on the colour hex, a tool such as http://www.colorpicker.com/ can be used to get the hex value you'd like to use.

Post reply
John Mosow
16th October 2017 at 9:16am

Thanks. I want to try to just change the link color. I made the following change but it does not make a change in the output.

<a {color:#fff000;} href="" target="" class="item _blank ">

When I inspect the element in my browser for the file name, I can see the color tag in there.

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi John,

Looks like you're missing your style tag there. Try this instead:

<a href="" rel="nofollow" class="item _blank " style="color:#fff000;">

John Mosow
16th October 2017 at 9:16am

Admittedly, I am not html programmer. Here is the changes I made. The icon no longer shows as a pdf icon for my files. And the file link is showing in yellow.

<a href="" rel="nofollow" target="" class="item _blank" style="color:#fff000;" ">

John Mosow
16th October 2017 at 9:16am

I have tried a number of variations of this and still no luck.

With this line, the text is in blue and the file icon is just a regular text icon:

<a href="" rel=”nofollow” target="" class="item _blank" style=”color:#fff000;" ">

This is the original code:

<a href="" target="" class="item _blank ">

Rick Mills
16th October 2017 at 9:16am

Hi John,

Looks like you've got an extra double quote at the end of your line there - it'll be causing the browser to confuse where the html tag ends. Change it to this and you should be all set:

<a href="" rel="nofollow" target="" class="item _blank" style="color:#fff000;">

Brian
16th October 2017 at 9:16am

I've installed the latest version of your script, and I can get the page to come up, but no matter what I set for my starting directory, the script keeps showing "this directory does not contain any files"

What am I doing wrong? My permissions should be all correct. I can run a different index.php directory listing script across this directory and it displays everything just fine.

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Brian,

You may find you need to tweak the value in your $startDirectory value.

Lets say your index.php is located at yoursite.com/files/ but you want to show files located at yoursite.com/downloads/ you'd need to set $startDirectory to 'downloads'. Alternatively, if you leave the $startDirectory field blank, it'll show files wherever your index.php file is located.

One final thing to check is permissions on the files, along with the file types - there's a list of file types that'll be hidden, so if for example you've got php files they'll be hidden as default. You can change this by editing the $ignoredFileExtensions variable.

If you're still having issues after trying these options, could you let me know your folder names and locations in relation to the index.php file to help work out why your files aren't showing.

Post reply
Brian
16th October 2017 at 9:16am

I have my index.php file located at the root of my site and there are a bunch of folders at the root of the site. Inside the folders, are a bunch of PDFs that I want to display (and sub folders).

The only way I can even get the script to show up anything when I pull up the site is to enter the complete folder path in the "startDirectory" variable. If I leave it at "." I get nothing. I have left ignored files at the default setting.

Apache has ownership of all the files and directories here and I don't think there is a permissions problem. Other, similar php scripts display everything just fine.

Thoughts?

Thanks for your help.

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Brian,

Very odd - I can't seem to replicate the issue you're having at all here. If you drop the "." from the startDirectory you'll likely see no files, however with it, you should be seeing files and/or directories there unless the $showSubDirectories variable is set to false.

Could I ask what your server setup is like?
- Linux or Windows
- Apache (or other httpd server) version
- PHP Version

Hopefully I can then set up a matching environment here and replicate the issue and get it fixed for you.

Thanks

Brian
16th October 2017 at 9:16am

I am running:

– SLES 11 SP4 (Linux)
– Apache 2.2.12-59.1
– PHP version 5.3.17-48.1

Thanks for checking into this

Brian
16th October 2017 at 9:16am

Any luck in replicating my problem or have any other thoughts as to why I can't get script to work?

Thanks

Rick Mills
16th October 2017 at 9:16am

Hi Brian,

Any chance you could post a list of installed PHP extensions on your server. I still can't seem to replicate the issue here so hopefully I can match up your setup as close as possible to see if there's potentially a minor difference in your PHP setup that could be causing the issue.

Brian
16th October 2017 at 9:16am

I am running:

- SLES 11 SP4 (Linux)
- Apache 2.2.12-59.1
- PHP version 5.3.17-48.1

Thanks for checking into this

Post reply
William Mocahbee
16th October 2017 at 9:16am

How do you change the footer blue to another color?

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi William,

Do you mean the blue footer link text? This can be changed by adding css into the header section or by including your own stylesheet.

A quick example of overriding the link colour would be:

a { color: #FF0000 !important; }

Placed just before the tag, this will set all links to red.

Post reply
Daniel
16th October 2017 at 9:16am

How to set the session data so as to list only directories only set for the current logged user and not others

Post reply
Artuom
16th October 2017 at 9:16am

Hello, please tell me how to correct the encoding? I have all the files in the Cyrillic alphabet.

Also interested in the opportunity to download an archive folder.

DEMO: http://school4.org.ua/dir/test/

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Artuom,

Looks like it's loading correctly now as it's showing the correct Cyrillic character set.

Post reply
Artuom
16th October 2017 at 9:16am

please tell me how to download the folder as an archive ?

Post reply
John
16th October 2017 at 9:16am

Eccellent work, ash! I like how you put everything you need in a single index.php script, even bootstrap. This is magic.

Post reply
AlzamyA
16th October 2017 at 9:16am

anyone can help me ? i use this script for my directory, when i try uploading rar and zip file it say error file type blocked, i already add the media type into script, but same error appear, maybe someone know how to fix this ? i am using latest evoluted directory listing version thanks

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi AlzamyA,

Zip files should already be supported as the correct MIME type for these is already in the $allowedUploadMimeTypes array.

Could you check that the file you're uploading is a valid zip file and not a proprietary file type.

Your zip file mime type should be application/zip.

To add support for rar files, add the following two entries the above mime type array (around like 105 in the index.php file)

application/x-rar-compressed
application/x-rar

Post reply
Feckie
16th October 2017 at 9:16am

I get the following

Fatal error: Class 'finfo' not found in C:\LiveWebSites\1.Evoluted-Directory-Listing-Script\index.php on line 672

in the new version

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Feckie,

You'll need to enable the fileinfo extension in php. This should resolve the issue you're having.

Post reply
Name (required)Stephen Browning
16th October 2017 at 9:16am

CommentHi Rick. Great script but as regards the finfo error.

If I use the new script on a page with just a feq jpg files it works. If I use the script on a page with a lot of jpg files it fails with the finfo error message.
A number of different users with different devices access my website pages. Do they all need PHP.INI modified? I can't seem to find PHP.INI on my Windows 7 PC.
Thanks and confused .... Steve

Post reply
Name (required)stephen browning
16th October 2017 at 9:16am

Hi again Rick, sorry for confustion. Realised I need to be looking at Server settings (dont often tough that on my ISP's Hosting Dashboard) but have just found the Hosting Settings and pushed the PHP version up to 5.6.30 (was on an obsolete 5.2!!) Haven't touched the PHP.INI yet as I'm not sure of the format to enable info..

stephen browning
16th October 2017 at 9:16am

HI there, just slogged through the PHP 5.6.30 info page on my ISP dashboard....

Fileinfo is enabled version 1.0.5 libmagic 517

GD support is enabled, compatible with version 2.1.0
jpeg support enabled libJpeg version 8

Regards

Steve

magnetux
16th October 2017 at 9:16am

same problem here, i got the same problem with brian,
– Windows 7 Pro 64 bit
– Apache 2.4
– PHP Version 5.6.15

Post reply
magnetux
16th October 2017 at 9:16am

i got my own solution, here is my solution, just edit php.ini and uncomment this line:
extension=php_fileinfo.dll
Remember to restart Apache for new php.ini to take effect.

It work for me !!!

Thank You.

Post reply
Rick Mills
16th October 2017 at 9:16am

Glad you're all up and running now Magnetux :)

Post reply
Brian
16th October 2017 at 9:16am

I installed the fileinfo extension for PHP and now it appears my problems are also solved. I will test to confirm later, but I can now see files. Thanks so much for the tip magnetux and thank you Rick for all your help!

Post reply
Brian
16th October 2017 at 9:16am

Got the script to show files. I can create sub directories. I can upload files except for PDF's. I have not blocked PDF file extension in the script and it is an allowed file type. I can upload other files, like Word documents, but when I upload a PDF it tells me "Your file could not be uploaded as your file type is blocked". Where should I look to fix this?

Post reply
bastetx
16th October 2017 at 9:16am

also have this issue, jpg uploads fine, but when it comes to pdf docs {which have been allowed}
no way ... slightly mystified

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Brian,

The latest version uses a slightly more reliable way of detecting the file mime type. Could you see if this addresses the issue with PDF's?

If you are still having the issue, could you let us know what application was used to create the PDF's as it could be that it's an issue with certain PDF types.

Post reply
Anders Skjoldebrand
16th October 2017 at 9:16am

Hello,

With the new version 4 script I stumbled over filenames starting with e.g.
Ö 214 00D6 Ö LATIN CAPITAL LETTER O WITH DIAERESIS
Å 197 00C5 Å LATIN CAPITAL LETTER A WITH RING ABOVE
Ä 196 00C4 Ä LATIN CAPITAL LETTER A WITH DIAERESIS

is missing the first character in the listing.

These are all typical Swedish characters.

These filenames show up in the listing WITHOUT the starting character and are also not found when clicked upon. (404 not Found)

If the same character ( upper or lower case) appears anywhere else in the file name it works fine.

Any suggestions why this happens?
Tested with Safari, Firefox and Chrome.
PHP is 5.6.16
Anders

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Anders,

We've released an update (v4.0.4) to address the character encoding issues. If you upload the latest version it should fix this issue for you.

Post reply
Anders Skjoldebrand
16th October 2017 at 9:16am

Rick,
With the 4.0.4 leve of the script there is still an issue with file names starting with non-ASCII characters. Sent some support info on "info@ .."
Also it appears that filtering of files, such as those of the type ".php" are displayed when navigating down 2 levels of sub-folders. It seems to work at the starting level and next level down.

Anders

Post reply
Roger Bennett
16th October 2017 at 9:16am

Hi great script I updated to new version as the zip files started to download corrupted ..

On the new version I get
Fatal error: Class 'finfo' not found in C:\LiveWebSites\feckie_games\Downloads\index.php on line 672
which is
$fi = new finfo(FILEINFO_MIME_TYPE);

Can you offer any assistance

installed on win 8.1 tried on 10 same on that as well

Roger

Post reply
Roger Bennett
16th October 2017 at 9:16am

Please Ignore all I wrote

After looking at the script I realised that i had to allow info in php.ini

Great Script

Regards

Roger

Post reply
Harinath
16th October 2017 at 9:16am

hello,

Every thing is working Fine but in my subdirectories i have multiple pdf files so how can i make them to display to users

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Harinath,

Assuming the file permissions are correct, your pdf files should be visible. There was however an issue with PDF's which has now been addressed in the latest release (v4.0.4).

Post reply
Brian
16th October 2017 at 9:16am

Is there a way to hide the "Last Modified" column?

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Brian,

You'll need to make a minor modification to the script to do this however it's fairly easy to do.

Using the latest version, scroll down to around like 1097 and you should see a line like this:

<td class="text-right sm-hidden"><?php echo date('M jS Y \a\t g:ia', $file['modified']); ?></td>

Comment out or remove this line. The just slightly further up you should see this:

<a href="sortUrl('modified'); ?>">Last Modified <span class="sortClass('modified'); ?>">

Again, comment out or remove this. This will remove the entire last modified column from display.

Post reply
David Xie
16th October 2017 at 9:16am

Hi There,

Thanks a lot for the work. I used it. It works good. Though, I had to make some changes to this script.

1. I need to make the script to have password for admin users, and admin users can login and do delete/create. Public user cannot do anything except for viewing.

2. I make the page to support UTF-8, so that binary language can be supported.

There is no way to upload the updated PHP file, but if you need it, please send me a email, I will mail to you.

I return this updated script is just to appreciate your work.

thanks a lot!

Dave

Post reply
John Mosow
16th October 2017 at 9:16am

I also needed to distinguish between and admin and a viewer. As I recall, I created a function to set the options for an admin and then ran the function if the logged in user was an admin. I use the folder access user for my username. Hope this code helps, I am no programmer.

if ($username == "AdminUser") {
$listing ->setadmin();
}

public function setadmin() {
$this->enableDirectoryCreation = true;
$this->enableUploads = true;
$this->enableFileDeletion = true;
$this->enableDirectoryDeletion= true;
}

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi David,

Sounds like you've made some great additions there! We've added the UTF-8 update into the latest release (4.0.4) however don't yet have separation between visitors and admins.

If you would like to send it to use for potential inclusion in a future update, please do feel free to email me (rick at evoluted.net).

Post reply
Robert
16th October 2017 at 9:16am

It would be better if you replaced the variables $file['type'] value to equal to mime_content_type($file['tmp_name']) as it provides a more valid mime-type based on the server rather than the browser/client in the __processUpload function.

Post reply
Rick Mills
16th October 2017 at 9:16am

Thanks Robert,

We've just posted an update that includes this change.

Post reply
Irfan Alam
16th October 2017 at 9:16am

BUG: If Folder or Sub Folder contain '&' in their name then contents inside that folder are not visible. It says "This directory does not contain any files."

I have more than 500 folders which contain & in their name and it is not possible to rename all manually.
How to solve this problem??

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Irfan,

Thanks for letting us know about this issue. We've just released an update (version 4.0.4) that fixes this.

Post reply
Irfan Alam
16th October 2017 at 9:16am

It is working for current folder but when it enters that folder then the link is again getting changed back to '&' instead of %26

For Ex: There is a folder >>index/folder&one/folder&two/folder&three
and I am at index level.
The link for the first folder is showing like this http://myweb.com/index/folder%26one
So clicking on this is working fine.

Now I am in folder&one and wanted to enter folder&two
The link for the second folder is showing like this
http://myweb.com/index/folder&one/folder%26two
So clicking on this is leading me to folder >> index/folder
Which is not a folder and hence showing no file in it.

Manually entering like this http://myweb.com/index/folder%26one/folder%26two is working fine.

Now I am in index/folder&one/folder&two and wanted to enter folder&three
The link is showing like this
http://myweb.com/index/folder&one/folder&two/folder%26three
Clicking on this is leading me to folder index/folder
which is not a folder.

Please look on this!

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Ifran,

We've released another update (4.0.5) to address this issue.

Shah
16th October 2017 at 9:16am

have you added any facility to also download seelcted or all files in form of zip or normal download.???

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Shah,

This isn't something that the script currently supports however it is something we can look at for a future update.

Post reply
seb
16th October 2017 at 9:16am

hello,
the script dont support "é" and "à" in folder or file name... how to ?
Thank

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Seb,

It sounds like your server isn't set up for UTF-8 encoding. We have released a minor bugfix update that sets the UTF-8 encoding heading in the script, however if you're still having issues after updating then it's likely going to be a hosting/server issue.

Post reply
George Spelvman
16th October 2017 at 9:16am

I searched for hours for a simple directory listing script with upload capabilities. This is elegant yet simple and delivers exactly what I need. Thanks so much!

Post reply
Anders Skjoldebrand
16th October 2017 at 9:16am

Rick,
Unexpected behavior ....
I have turned of all options to allow upload, delete files and directories ... IOW only subdirectories and files are visible.
This work fine on the initial folder, but as I move down to the next subdirectory, all the options I turned off are now visible.
And as I move down one subdirectory further, all options are visible and on top of this files with e.g "php" are starting to show up.
Is this in any way dependent upon how the "startdirectory" or "$includeUrl" options are set?

Anders

Post reply
Anders Skjoldebrand
16th October 2017 at 9:16am

Rick,
After the 404 update of the script, these is still an issue with file names starting with non-ASCII characters, as described in my original posting on UTF problems.
I did not know how to relay support info, so I sent a mail to your "info@ ..." with traces.

Anders

Post reply
Rick Mills
16th October 2017 at 9:16am

Hi Anders,

Thanks for your email. We've just released an update (4.0.5) with additional special character support. I've tested this with the filenames you provided in your email and they now link correctly.
We've also corrected the issue you were having with hidden files being incorrectly displayed in sub-directrories

Post reply
Anders Skjoldebrand
16th October 2017 at 9:16am

RICK,

Yes, the unwanted files have now been suppressed with version 4.0.5.
Unfortunately, the file names starting with non-ASCII characters are still missing their first character and cannot be displayed.
Also, when options, such delete and upload files, are turned off in the script, they are certainly hidden at the top level, but as you move down a level to the next subdirectory, they appear as if they have never been turned off.
I tried to document this in a mail to "info@ ..".

Anders

Post reply
seb
16th October 2017 at 9:16am

hello,
Thank for the new version but now I have this error :

Warning: filetype(): Lstat failed for F:\FILMS-SERIES-MP3\La petite Sir?ne.mp3 in F:\FILMS-SERIES-MP3\MP3\index.php on line 658

do you have a solution please ?
Thank

Post reply
Brian
16th October 2017 at 9:16am

With the new version of the script, I cannot get files to display properly. With the older version (4.0.3 I believe), I did not have to set "startDirectory" variable or any other variables, but now it appears I do need to set them just to get the script to appear, and even then I get now file/folder listings. Thoughts? I am reverting back to older version for now while I do more testing.

Thanks!

Post reply
Irfan Alam
16th October 2017 at 9:16am

How to show Download Count for files?
Is there any plan to add this in future?

Post reply
masum65
16th October 2017 at 9:16am

searched for hours for a simple directory listing script with upload capabilities. This is elegant yet simple and delivers exactly what I need. Thanks so much!

Post reply
Sergey
16th October 2017 at 9:16am

Hi,
I just downloaded your the script. installed and tried to run - i got the error message "Fatal error: Class 'finfo' not found in C:\xampp\htdocs\archive\index.php on line 674"

Post reply
Horst
16th October 2017 at 9:16am

How can add a background-image tag, directly to the php-script?

Post reply
Harinath
16th October 2017 at 9:16am

I have changed the name of the Index file to Index1.php
Will it effect the Script?
Also my sub directories also working fine,files are displaying but when i try to open the file its showing 404 error,
because the link is displaying index1.php also
Ex: http://www.radialsinternational.net/index1.phpMR/Monthly%20Reports%20-2014/Monthly%20Report%20Aug,14/Monthly%20Report_GKOC_24.00%20R%2035_Aug'14.pdf
Will throw 404

After removing index1.php manually the file is displaying
plz help.

Post reply
byman64
16th October 2017 at 9:16am

I fixed it just yesterday, I arrived too late for you, maybe some other needs the fix.
I renamed my index.php to index07.php and I got some issue when I tried to open a file: index07.php was included in the url with the result of url wrong and error 404.
Well I added 2 php lines to replace the script name with empty, it mean removed.

1) Search for
private function __getUrl($file) {
2) Replace all function wuth mine or just add my code tagged byman

private function __getUrl($file) {
if (! $this->includeUrl) {
$dirUrl = $_SERVER['REQUEST_URI'];

$urlParts = parse_url($_SERVER['REQUEST_URI']);

$dirUrl = '';

if (isset($urlParts['scheme'])) {
$dirUrl = $urlParts['scheme'] . '://';
}

if (isset($urlParts['host'])) {
$dirUrl .= $urlParts['host'];
}

if (isset($urlParts['path'])) {
$dirUrl .= $urlParts['path'];
}
} else {
$dirUrl = $this->directoryUrl;
}
// byman 20170710 START
// if index.php in the url or script renamed in other name like index07.php, url created were wrong, replaced the php script name with empty
$scriptIndex=basename(__FILE__, '.php');
$dirUrl=str_replace($scriptIndex.".php","",$dirUrl);
// byman 20170710 END

if ($this->__currentDirectory != '.') {
$dirUrl = $dirUrl . $this->__currentDirectory;
}
return $dirUrl . rawurlencode($file);
}

- have fun -

Post reply
harinath
16th October 2017 at 9:16am

http://www.radialsinternational.net/MR/Monthly%20Reports%20-2014/Monthly%20Report%20Aug,14/Monthly%20Report_GKOC_24.00%20R%2035_Aug'14.pdf

will give file

Post reply
JP
16th October 2017 at 9:16am

I have the same issue, is there a fix to be able to rename the script and keep the links working?

Post reply
John
16th October 2017 at 9:16am

How to upload .php files? When I try it says "Your file could not be uploaded as the file type is blocked."

Post reply
Thorsten
16th October 2017 at 9:16am

Hi.

This is a great script...thanks a lot for sharing it! :-)

The only thing....I'm from Germany and we have such weird signs like öäüß....since UTF8 was implemented the filenames are shown correctly. But I also translated the text on the buttons, i.E. Delete is now Löschen, Size is Größe and so on.
The text on the buttons isn't shown with the special signs, it's showing symbols.

Is there a way to show öäüß on those buttons?

Thanks
Thorsten

Post reply
banyakfilm
16th October 2017 at 9:16am

Hey, how to download 1 folder ?

Post reply
Winston
16th October 2017 at 9:16am

Is there any way to make the width smaller when accessing from laptop and desktops. Moreover please tell me If I can remove the modificaion description and file size. Please help me out asap.
Thanks

Post reply
Winston
16th October 2017 at 9:16am

Is there any way to make the width smaller when accessing from laptop and desktops. Moreover please tell me If I can remove the modificaion description and file size. Please help me out as soon as possible.
Thanks

Post reply
steve
16th October 2017 at 9:16am

Hi,
Setup is Win Server 2012 R2, IIS 8, PHP 5.6. I have a folder specified in the StartDirectory and its displaying fine, and all the breadcrumb links work fine as I navigate around. However, the link to "Index" gets set to "./" and that causes navigation to fail...just displays "This directory does not contain any files" with no other links. The url in the browser shows "http://a.domain.com/?dir=./" ....if I manually just remove the "." and make the url "http://a.domain.com/?dir=/", it displays correctly. This must be a windows thing...as I haven't heard anybody else say anything about it. Do you know what I can do to make it display the "Index" link correctly?
Thanks for a great script! I love this thing!

Post reply
steve
16th October 2017 at 9:16am

Ok, one more bit of information...so I played around with placing the script in a folder off the web root...when I do that, it works perfectly. I just can't place it in the web root. If I do that, it never finds any folders/files. So, it seems, on a windows setup, it must be in a folder to function correctly, is that right? I operate the server so I can change any settings, so let me know if there is a config setting I need to change. Thanks!

Post reply
McFire
16th October 2017 at 9:16am

I've changed some things in styles.css , so it's extendet now to 900px. With the help of some hints from here it was done successful. Also changed the assiciated pts in index.php to 75 resp. 72 . But despite of having more space now the filenames doesn't expand. What is to do?

Post reply
McFire
16th October 2017 at 9:16am

Fixed a selfconstructed bug, now it runs correct. And here I've set a picture with all needed stuff for expanding the dir window.
http://www.letterchip.de/kramkiste/dirliststructure.gif
So you have all at one single point.
Thanks again to all helpful hint writers here.

Post reply
Sandor
16th October 2017 at 9:16am

It would be great if the script could show directory headers. Maybe in a new version? ;-)

Post reply
Ash Young
16th October 2017 at 9:16am

What do you mean by directory headers?

Post reply
Sandor
16th October 2017 at 9:16am

An html file (i.e header.html and footer.html) with text to display in header and footer of the directory listing.

It would also be interesting files.bbs or descript.ion support, for files comments... :-)

Post reply
Menace T
16th October 2017 at 9:16am

Hi Im in the process of constructing a music site and I would like to know if its possible to display the number of times a file is downloaded.

Post reply
Menace T
16th October 2017 at 9:16am

Hi Im in the process of constructing a music site and I would like to know if its possible to display the number of times a file is downloaded. This a really great script BTW.

Post reply
Sasha
16th October 2017 at 9:16am

It is very very good PHP Script.
Customizable, fast, beautiful. High-technology original engineering solutions.

Thank you !!!

Post reply
Andras
16th October 2017 at 9:16am

I am running PHP 5.4.0 on an IIS.
I get no listings of any kind, but "This directory does not contain any files.".

The directory has both files and subdirectories in it.
The start directory is left blank:
public $startDirectory = '';

(If I as much as put a dot in there, the script presents only a blank screen.)

Can someone advise, please?

Post reply
JP
16th October 2017 at 9:16am

The reason for this is to be able to have a viever mode and an admin mode. If there is another solution for this please inform.

Post reply
sev
16th October 2017 at 9:16am

hello
thanks for this clean and cool script!
greets sev

Post reply
مطاعم الجبيل الصناعية
16th October 2017 at 9:16am

thx for this php
any demo guys?

Post reply
ynef
16th October 2017 at 9:16am

Wow. Just wow! Such a beautifully written, clean and tidy script. It's a bliss going through the source code.

Post reply
Ben
16th October 2017 at 9:16am

Hi

nice script.

Is it possible to sort the directories based on date created or changed ?

Post reply
Joseph
16th October 2017 at 9:16am

Thank you for a great script!!!
Is it possible to change the default white background color?
Thanks.
Joseph

Post reply
gUngoR
16th October 2017 at 9:16am

i only can say AWESOME :)

Post reply
Raj
16th October 2017 at 9:16am

Thanks for sharing such a useful information with us. I will definitely use these php scripts for creating my directories websites.

Post reply
Jeremy
16th October 2017 at 9:16am

Brilliant script. Very useful. I've been running version 3 for years and loved it. Version 4 is quite an improvement! Looks much more modern (thank you, Bootstrap) and responsive.

One tiny question: Can the directory sort be made to be case-INsensitive?

In version 3, it was case insensitive, but in 4 the lowercase directories follow all the Mixed-case directories. Unless I've missed a configuration option somewhere...?

Thanks!

Post reply
Mario Hofer
16th October 2017 at 9:16am

I just came up to this site so solve my problem with an easy directory listing scrip. I liked the password option and flexibility. A bit annoying was the wrong link generation for the files - it worked with a direct download from the browser, but not if the link is passed to a different application / browser addin.

As a newbe to php I just found the following solution to "erase" the script name in the links in the html table creation part:

href=""

Maybe that helps someone.

Post reply
Marion
16th October 2017 at 9:16am

I tried adding to the list of hidden files in the config.php file, but it didn't work for some reason. I only want PDF's to display to the public. No other types of files. What's the easiest way to accomplish this?

Post reply
Krishna
16th October 2017 at 9:16am

Works well...configuration is simple and nice...
Thank you !

Post reply
labware chemicals and scientific equipments
16th October 2017 at 9:16am

Aw, this was an incredibly good post. Finding the time
and actual effort to create a really good article… but what can I say… I
hesitate a whole lot and don't seem to get nearly anything done.

Post reply
Z
16th October 2017 at 9:16am

Is there a way to list index.php files? Or what might be the problem if those don't show up in the list?

Post reply
Jim Fulmis
16th October 2017 at 9:16am

I would really like to use this script but I cannot get it to list files. I tried another php directory lister & it works just fine but I would prefer to use this one. I'm on php 5.6 & my folder permission is 755, files are 644. I hope you can help with this. I had an audio file that was an m4a which thru an error. The I added that extension in & no more errors so it's scanning the files but says "This directory does not contain any files" every time.
Please advise

Post reply
Adam
16th October 2017 at 9:16am

Great script. I was looking for something.
It does not recognize only the Polish characters " ążźćłóęń ĄŻŹĆĘŁÓŃ".
Something can do with it?
Regards

Post reply
Bernd
16th October 2017 at 9:16am

I just found your script and find it pretty amazing! I think I will use it on projects(web dev)
Initially I was looking for a directorylister with the feature of reading an additional .md file in the directory and display its contents, like version or changes to flles in a directory. If an md file is present display it between DIRs and files.

If you ever get bored... It would make me very happy ;-)

Post reply
ArminC
16th October 2017 at 9:16am

Can you add "Download the folder as archive (rar, zip) " feature ? Thanks!

Post reply
John Nicholls
16th October 2017 at 9:16am

This is a great piece of work - thank you!

I am a beginner and I am having difficulty with the script.

My files are listed nicely, but I cannot delete files. Also, files cannot be opened - the page is simply refreshed as a new page. Can anyone offer any advice please?

Post reply
judgedredd
16th October 2017 at 9:16am

Hi, I was using version 3 for years for displaying files in a directory which also had sub-directories (total of about 50,000 files +). Recently I discovered that the script was causing problems with large file downloads. I had a few large files of 450MB or more and I was notified that these files failed to download properly.

When I tested it out for myself these large files would stop between 450 and 500MB in download amount. This came to light when I uploaded files for downloading that were 3.4GB in size. These files allowed anyone to duplicate my database of files on their computer (important archival material for anyone to read and study).

Is there a download size limit in your newest script (ver. 4)?

I tried your latest version (I can't find ver.4.05) and there was an fatal error on the finfo class. Not sure if my hosting company will enable the fileinfo extension as they usually don't allow ay customization on my shared hosting plan.

I have reverted back to ver. 3 until I hear from you about the above issues.

Post reply
judgedredd
16th October 2017 at 9:16am

Hi again, I just saw that the file name is the version number. You need to add the version number into the text of the page at the top where the version number is given. Makes for much easier location as that is usually the standard place to find it. It is also more logical and gets rid of any confusion as to which version one has.

Post reply
Srini
16th October 2017 at 9:16am

Such a wonderful script. Thanks a ton guys. You saved a lot of effort.

Post reply
Giovanni Melendez
16th October 2017 at 9:16am

This script is fantastic.

How can I do to open link in the same windows or same frame?

Post reply
trabajar en internet
16th October 2017 at 9:16am

Oh thank you very much

Post reply
Johan
16th October 2017 at 9:16am

Hi, installed and tested the script today. Thanks for providing it! Everything works beautifully EXCEPT for the fact that swedish characters are either removed from directory and file names (on local dev server) or shown and handled incorrectly (on production server).

I'm using apache and has set it up both servers with htaccess directives:
AddCharset UTF-8 .html .php .css .js
DefaultLanguage sv_SE

Any tips on where I should start troubleshooting would be helpful.

Post reply

Leave a comment

Replying to: - Cancel