Swamp Geek

Replacing File Thingie with Tiny File Manager
Date: Thursday, April 18, 2024 @ 14:56:43 CDT
Topic: Swamp Tech


The great, simple, single-file PHP file manager, File Thingie, made it really easy to manage files to download from a web server by simply loading the File Thingie index.php into a folder.  Sadly, File Thingie disappeared between August 12, 2015 and September 7, 2015.  As PHP changed, File Thingie stopped working (I think with PHP 8.x, but test for yourself if you need to know).  Since I still have a need for simple file management, I looked for alternatives and find Tiny File Manager.

Like its predecessor File Thingie, Tiny File Manager enables users to securely manage files using a single PHP file.  However, unlike File Thingie, Tiny File Manager enables editing of all files in the root folder, rather than all files in and below the current folder.  Let's say you want to use a /documents subfolder to allow users to upload documents (e.g. PDFs, Excel spreadsheets, Word documents and Powerpoint presentations).  By default, even if you load tinyfilemanager.php into the documents folder, users will have access to the folders above /documents.

Changing 2 configuration parameters ($root_path and $root_url) limits tinyfilemanager to the current folder and below and correctly displays direct links:

// Root path for file manager
// use absolute path of directory i.e: '/var/www/folder' or $_SERVER['DOCUMENT_ROOT'].'/folder'
#$root_path = $_SERVER['DOCUMENT_ROOT'];
$root_path = __DIR__;

// Root url for links in file manager.Relative to $http_host. Variants: '', 'path/to/subfolder'
// Will not working if $root_path will be outside of server document root
#$root_url = '';
$root_url = preg_replace("!^${_SERVER['DOCUMENT_ROOT']}!", '', __DIR__);
Now, if there was only a simple way to replace the view link with a direct link instead of having to select the tiny direct link icon to the right...








This article comes from Swamp Geek
http://swampgeek.com

The URL for this story is:
http://swampgeek.com/modules.php?name=News&file=article&sid=62