Closed pisoj1 closed 8 years ago
It should look like this if you want to go down a level:
$items = scandir( dirname(__FILE__) . '/../foldername' );
And up a level:
$items = scandir( dirname(__FILE__) . '/foldername' );
im having same problem.
works fine in same folder but not in another.
I Tried the suggested:
$items = scandir( dirname(__FILE__) . '/../foldername' );
the folder and files from the other directory show up but i get errors:
Warning: filesize(): stat failed Warning: filemtime(): stat failed for
root -pdf --files ---2017 ---2016 ---Coming Soon.pdf -pages --fileviewer ---Filebrowserscript.html
this is my file layout so i used:
$items = scandir( dirname(__FILE__) . '/../../pdf/files' );
and also tried with no luck:
$items = scandir( dirname(dirname(dirname(__FILE__))) .'/pdf/files' );
@coolshrimp if your index.php file is in the root, you would want to do:
$items = scandir( dirname(__FILE__) . '/pdf/files' );
Correct way to do that on PHP 7:
$items = scandir( dirname(__FILE__, 2) );
You can change "2" for your desired folder level. It goes one level up when you increase 1. There will be errors for "filemtime()" and "filesize()" when you change it. Don't know how to fix them.
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.