Reputation: 2200
I'm using the jQuery FileTree plugin. The php connector uses scandir to get a folder's contents. After I upload images, my uploader script creates a "thumbs" folder, and then makes a thumbnail version of the image, and stores it there.
Users will be operating on the files within each image folder, but I don't really want them seeing the "thumbs" folder that's within each image folder. I could move the thumbs folder to some other place, but that would be kind of a huge undertaking.
Is there a way to make the "thumbs" folder my upload script creates a hidden folder, unseeable by scandir?
$files = scandir($postDir);
$returnDir = substr($postDir, strlen($root));
Upvotes: 1
Views: 668
Reputation: 38238
Make a custom version of jQueryFileTree's php connector, adding your exclusion to the filtering, around line 55:
if( file_exists($postDir . $file) && $file != '.' && $file != '..' && $file != 'thumbs') {
Then use that script instead of the standard connector by passing its name as the script
parameter to the fileTree
function when creating the tree on the JS side.
(Depending on what states your directories can be in, e.g. whether you'll always have a "thumb" folder, etc., you may also need to adjust the if( count($files) > 2 )
, but this should give you the basic principle -- just create your own connector and customise it as necessary.)
Upvotes: 1