### TinyFileManager Installation Source: https://github.com/prasathmani/tinyfilemanager/wiki/Get-Started This snippet describes the basic installation of TinyFileManager, which involves downloading the latest version and copying the `tinyfilemanager.php` file to the webspace. It also mentions the possibility of renaming the file. ```PHP ``` -------------------------------- ### Docker Deployment for Tiny File Manager Source: https://github.com/prasathmani/tinyfilemanager/blob/master/README.md This snippet provides a link to the Docker deployment guide for Tiny File Manager. It indicates that Docker can be used to deploy the file manager, simplifying the setup process. ```Markdown [Deploy by Docker](https://github.com/prasathmani/tinyfilemanager/wiki/Deploy-by-Docker) ``` -------------------------------- ### PHP: Generate Password Hash Source: https://github.com/prasathmani/tinyfilemanager/wiki/Security-and-User-Management Demonstrates how to generate a secure password hash using the `password_hash()` function for user authentication in TinyFileManager. ```PHP $auth_users = array( 'username' => password_hash('password here', PASSWORD_DEFAULT) ); ``` -------------------------------- ### Configure TinyFileManager Root Path and URL (PHP) Source: https://github.com/prasathmani/tinyfilemanager/wiki/Deploy-by-Docker These PHP code snippets demonstrate how to modify the configuration for TinyFileManager within a Docker environment. The first snippet shows the default configuration, while the second illustrates how to set the root path to '/var/www/html/data' and the root URL to 'data/'. ```php // 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 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 = ''; ``` ```php // 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'].'/data'; // 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 = 'data/'; ``` -------------------------------- ### Run TinyFileManager with Custom Index.php Volume Source: https://github.com/prasathmani/tinyfilemanager/wiki/Deploy-by-Docker This Docker run command is an extension of the initial deployment, adding an extra volume mount for a custom 'index.php' file. This allows for further configuration of TinyFileManager by providing a modified PHP configuration file directly to the container. ```shell $ docker run -d -v /absolute/path:/var/www/html/data -v /absolute/path/index.php:/var/www/html/index.php -p 80:80 --restart=always --name tinyfilemanager tinyfilemanager/tinyfilemanager:master ``` -------------------------------- ### View Running Docker Containers Source: https://github.com/prasathmani/tinyfilemanager/wiki/Deploy-by-Docker This command lists all currently running Docker containers, showing their ID, image, command, creation time, status, ports, and names. It's useful for verifying that the TinyFileManager container is active. ```shell $ docker ps ``` -------------------------------- ### PHP: Configure User Specific Directories Source: https://github.com/prasathmani/tinyfilemanager/wiki/Security-and-User-Management Sets up user-specific directory access, limiting users to specific folders for uploading, downloading, and file manipulation. ```PHP // user specific directories // array('Username' => 'Directory path', 'Username2' => 'Directory path', ...) $directories_users = array( 'user' => 'root/user-folder', 'guest' => 'root/guest/temp' ); ``` -------------------------------- ### Run TinyFileManager with Docker Source: https://github.com/prasathmani/tinyfilemanager/wiki/Deploy-by-Docker This command deploys the TinyFileManager container using Docker. It maps a local absolute path to the container's web root, exposes port 80, and ensures the container restarts automatically. The container is named 'tinyfilemanager' and uses the 'master' tag from the tinyfilemanager/tinyfilemanager image. ```shell $ docker run -d -v /absolute/path:/var/www/html/data -p 80:80 --restart=always --name tinyfilemanager tinyfilemanager/tinyfilemanager:master ``` -------------------------------- ### PHP Configuration for Tiny File Manager Source: https://github.com/prasathmani/tinyfilemanager/blob/master/README.md This snippet demonstrates how to configure Tiny File Manager by setting authentication users and enabling/disabling authentication. It shows how to define user credentials and manage access control. ```PHP 'password_hash(\'admin\', PASSWORD_DEFAULT)', 'user' => 'password_hash(\'user\', PASSWORD_DEFAULT)' ]; // To enable/disable authentication set $use_auth to true or false. $use_auth = true; ?> ``` -------------------------------- ### PHP: Configure Authentication and User Credentials Source: https://github.com/prasathmani/tinyfilemanager/wiki/Security-and-User-Management Enables or disables authentication and defines user credentials with password hashes. Users can be granted read-only permissions. ```PHP // Auth with login/password // set true/false to enable/disable it // Is independent from IP white- and blacklisting $use_auth = true; // Login user name and password // Users: array('Username' => 'Password', 'Username2' => 'Password2', ...) // Generate secure password hash - https://tinyfilemanager.github.io/docs/pwd.html $auth_users = array( 'admin' => '$2y$10$/K.hjNr84lLNDt8fTXjoI.DBp6PpeyoJ.mGwrrLuCZfAwfSAGqhOW', //admin@123 'user' => '$2y$10$Fg6Dz8oH9fPoZ2jJan5tZuv6Z4Kp7avtQ9bDfrdRntXtPeiMAZyGO', //12345 'guest' => '$2y$10$a.DMI5sRjAnvhb.8rFAXY.XPSEO/eatVb4qCMmTc2YcxTDKp9xMyC' //guest ); ``` -------------------------------- ### Configure File Creation/Rename Extensions Source: https://github.com/prasathmani/tinyfilemanager/wiki/Config-Flags Specifies the file extensions that are allowed when creating new files or renaming existing ones. This ensures consistency in file types managed by the system. ```PHP $allowed_upload_extensions = "html,css,js"; ``` -------------------------------- ### PHP Configuration for Custom File Source: https://github.com/prasathmani/tinyfilemanager/blob/master/README.md This snippet shows how to use a custom configuration file named 'config.php' with Tiny File Manager. This allows for additional configurations to be loaded separately from the main script. ```PHP ``` -------------------------------- ### Configure Tiny File Manager IP Access Control (PHP) Source: https://github.com/prasathmani/tinyfilemanager/wiki/IP-Blacklist-and-Whitelist This PHP code snippet demonstrates how to configure IP whitelisting and blacklisting for Tiny File Manager. It includes settings for the ruleset ('OFF', 'AND', 'OR'), silent blocking, and arrays for both whitelisted and blacklisted IP addresses (IPv4 and IPv6). ```PHP // Possible rules are 'OFF', 'AND' or 'OR' // OFF => Don't check connection IP, defaults to OFF // AND => Connection must be on the whitelist, and not on the blacklist // OR => Connection must be on the whitelist, or not on the blacklist $ip_ruleset = 'OFF'; // Should users be notified of their block? $ip_silent = true; // IP-addresses, both ipv4 and ipv6 $ip_whitelist = array( '127.0.0.1', // local ipv4 '::1' // local ipv6 ); // IP-addresses, both ipv4 and ipv6 $ip_blacklist = array( '0.0.0.0', // non-routable meta ipv4 '::' // non-routable meta ipv6 ); ``` -------------------------------- ### Configure Allowed Upload Extensions Source: https://github.com/prasathmani/tinyfilemanager/wiki/Config-Flags Sets the file extensions that are permitted for uploads. This helps in controlling the types of files users can add to the file manager. ```PHP $allowed_upload_extensions = "jpg,png,pdf,gif,html,css,js"; ``` -------------------------------- ### PHP: Define Readonly Users Source: https://github.com/prasathmani/tinyfilemanager/wiki/Security-and-User-Management Specifies users who will have read-only permissions, preventing them from creating, editing, deleting, or uploading files. ```PHP // Readonly users // e.g. array('users', 'guest', ...) $readonly_users = array( 'user', 'guest' ); ``` -------------------------------- ### PHP: Configure Allowed File Extensions Source: https://github.com/prasathmani/tinyfilemanager/wiki/Restriction-by-file-type This snippet shows how to configure allowed file extensions for creating/renaming files and for uploading files using PHP variables in Tiny File Manager. The `$allowed_file_extensions` variable controls which extensions can be created or renamed, while `$allowed_upload_extensions` controls which extensions can be uploaded. ```php // Allowed file extensions for create and rename files // e.g. 'txt,html,css,js' $allowed_file_extensions = 'txt,html,js,css,scss'; // Allowed file extensions for upload files // e.g. 'gif,png,jpg,html,txt' $allowed_upload_extensions = 'jpg,jpeg,gif,txt,mp4'; ``` -------------------------------- ### Stop and Remove TinyFileManager Docker Container Source: https://github.com/prasathmani/tinyfilemanager/wiki/Deploy-by-Docker This command forcefully removes a running Docker container. It's essential for stopping the TinyFileManager service before attempting to restart or redeploy it, preventing conflicts with existing container names. ```shell $ docker rm -f tinyfilemanager ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.