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

Filetime and filesize warnings #20

Open oleteacher opened 5 years ago

oleteacher commented 5 years ago

Hey, great simple little script! Thanks for sharing.

I followed instructions @ https://github.com/halgatewood/file-directory-list/issues/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.

ukadmin commented 5 years ago

Hey, I think same Problem is here.. But only when i include it to my template. When i use it itselfe no Problems. You can solve it?

filemtime(): stat failed for

oleteacher commented 5 years ago

Pretty sure something to do with path, but found no solution.

ukadmin commented 5 years ago

there must be a way to change the path. You have the index.php in your folder directory or you include ?

oleteacher commented 5 years ago

"there must be a way to change the path. You have the index.php in your folder directory or you include ?"

Path is not the real issue. I have the index.php in the directory, not include.

The issue is after making mod mentioned in https://github.com/halgatewood/file-directory-list/issues/5

Once the path is set:

$items = scandir( dirname(__FILE__) . '/pdf/files' );

I have the warnings and 0 byte files size.

harrier77 commented 5 years ago

Hello, I tried to use the script outside its folder (something like "../folder/etc"). To make it working I needed to change the function ext() in this way, I think it can solve the warnings:

function ext($filename) { if (is_dir($filename)==false): return substr( strrchr( $filename,'.' ),1 ); else: return false; endif; }