halgatewood / file-directory-list Goto Github PK
View Code? Open in Web Editor NEWFree Super Clean PHP File Directory Listing Script
Home Page: https://halgatewood.com/free/file-directory-list/
Free Super Clean PHP File Directory Listing Script
Home Page: https://halgatewood.com/free/file-directory-list/
Nice script!
I found a small problem with folder names containting dots, the script treats them as files.
I changed line 177 from:
if( !$file_ext AND is_dir($file)) $file_ext = "dir";
to
if( is_dir($file)) $file_ext = "dir";
The $file_ext check is redundant anyway.
Hi to all,
I maked an update to get it worked also on a modal windows.
the problem was is the path, becouse on a modal windows you lose the path of the file, and you can't download it.
inside the Function display_block( $file ) I have added a line to retrive the path
$absolute_path = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://" . $_SERVER["SERVER_NAME"] . '/' . trim(dirname($_SERVER["PHP_SELF"]),'/');
then I put the result inside herf just before $file
$rtn = "<div class="block">";
$rtn .= "<a href="$absolute_path\$file" class="$file_ext"{$download_att}>";
$rtn .= " <div class="img $file_ext">";
$rtn .= " <div class="name">";
what do you think?
Best regards
Stefano
to be able to add alttext or description for each file ?
and preview for PDF and image files possible ?
Thank you ,
God Bless
"Jesus Loves You"
"For I know the plans I have for you,” declares the Lord, “plans to prosper you and not to harm you, plans to give you hope and a future." Jeremiah 29:11
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life." John 3:16
Firstly, great clean script, thank you for sharing!
After few attempts, I cannot figure out how to prevent folder listing. Like to have only files listed, is this possible?
If I may make a few suggestions to make your dir listing script better:
Thanks again for sharing, really useful script.
Woody
Thank you very much for the script, can you upload the flat.png file to the repository?
Hi just wondering if there is a way to make this script start in a particular folder rather than the root?
I tried changing $items = scandir( dirname(FILE).'./foldername' ); but as a result I get loads of filemtime() errors.
Hi, i have the following option enabled:
// FORCE DOWNLOAD ATTRIBUTE
$force_download = true;
but i want to make html files opened in a new tab.
how can i do this ?
Hi!
I think you should add the link to the demo to the repo.
When i secure my Server with SSL, index.php stops working.
Apache2 PHP7.3 Certbot
how can I do password protect?
Hi
Thanks a lot for this perfect directory php <3
I have problem with utf8 character text like arabic or persian language in file names!
example : فایل.docx
plz help :-)
Not to complicate this wonderful simple script, but I've always wanted a way to implement a download count for each file.
Hi, thx for share your work.
I just downloaded the last version 1.9 and folder size always shows 4kb.
screenshot with folder size missing
note:
I have an old version without version inside and folder size works fine.
In this version I only fixed the icons becuase they were missing .
screenshot with folder size
Any idea why in the new version size is wrong?
UPDATE - 1
In the oldone there is a call to the function : format_size_from_bytes(foldersize($file))
It is missing in the version 1.9
screenshot with code compared
UPDATE - 2
You can download the UNKNOWN version with folder size feature until 2017-10-31
unknown version with folder size feature
UPDATE - 3
Just updated your last version 1.9 adding the feature for folder size.
I called it 1.9.1
Changes:
You can download from the following link until 2017-10-31
file directory-list with folder size
UPDATE - 4
I am working on some other little stuff:
***[OT]
Sorry but I dont know how github works, I have an account, I need to read some. Let me give you my new code with a simple link...1.9.2 will arrive soon.
I hope you will include the folder size feature in your next version.
regards
thx
Line 139 in b48be52
I fixed this problem by change to:
if( is_dir($file))
$file_ext = "dir";
else
$file_ext = getFileExt($file);
Hey, great simple little script! Thanks for sharing.
I followed instructions @ #5 to change listing dir and it works, but getting errors like:
Warning: filemtime(): stat failed for test.csv in /opt/lampp/htdocs/testbed/filelister/filelister.php on line 243
Warning: filesize(): stat failed for test,.csv in /opt/lampp/htdocs/testbed/filelister/filelister.php on line 198
Any ideas how to solve and get the time / size showing? File Size show 0 and time is THU. JANUARY 1ST, 1970 - 01:00AM
Running PHP 7.3
Thanks again.
Would it be possible to ignore a directory just as you can ignore specif files?
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
Please make it responsive and add dark theme.
Hello,
Recently found this via a friend but i want to add an icon for APK files... how would i do this please?
Thanks in advanced
Hello Hal and thank you for your great job !
Hey ! Am I the only one to see folders containing " . " inside as file, so not opening as a folder ?
Can you try too ?
Thanks !
I think the icon for that could be two dots and a slash, grey, first in the list and maybe without a name.
Hello,
I have downloaded your script and found, that the sorting settings is ignored. I have tried to sort folders by name descending, but unfortunatelly I is not possible.
Thanks a lot for any help
Many thanks for the php script.
In next version would it be possible to add a function to upload files?
Thanks,
Greetings! Is there a way to define "storage" folder?. For example, i want to directory lister start from folder "storage", without showing folder "other_files". I know, easiest way is simply move index.php to "storage" folder, but i need the way i've described.
-ROOT_FOLDER
----index.php
----storage
----------------1.jpg
----------------2.jpg
----------------3.jpg
----------------4.jpg
----------------file1.mp4
----------------file2.mp4
----other_files
----------------file1.jpg
----------------file2.mp4
Dear all
First of all thanks for wonderful work.
I was wonder if it's possible add some kind of password protection or log in process ?
Files like 4GB are do not shows size at all
I have an issue, it's about 2 day and i dont konw how to get it off.
After a plesk update (minor update) script doesnt work.
I can see files and folders in root directory, but folders doesnt work. Error 403 forbidden while trying to get into the folders
This is plesk log about this.
AH01276: Cannot serve directory /var/www/vhosts/XXXXXXX/httpdocs/test/CR1/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm,index.shtml) found, and server-generated directory index forbidden by Options directive, referer: https://XXXXXXXX/test/
I didn't use any .htaccess before, i tried to use "Options +Indexes" to enable directory listing, it works, but it's "Apache listing" not the script.
I'm open to any advice.
You should add m4v and m4a to your item list so they will have an icon.
I'm currently coding a custom dashboard that compares my the files on my server with the commits of a Github repository. However, I'd like to share this across multiple sites.
Is there a way to put this in the base directory of my server and reference it in other sites? I'm sure it's stupid simple, but I'm a bit rusty when it comes to php.
Hi,
Thank you for your sharing. My problem with this code, my main folder looks like a file with a file icon, and when I click it, it begins to download. I just copied and pasted your index.php.1.10.txt code, and added a folder with two subfolders and files in it.
Could you help?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.