A good solution for managing files and folders for developers who can't access their site over SSH or FTP or who need "www-data" permission (*nix).
WARNING! Do not use this script as a regular file manager in public area. After all actions you must delete this script from the server.
And: Skip error reporting! This tools does a good job but take care and don't
look behind the scene :) Test it first in a save enviroment (eg.:
define('FM_ROOT_PATH', '/tmp'); // playground first!
- PHP 5.2 / PHP 7++
- Zip extension for zip and unzip actions.
- Fileinfo, iconv and mbstring extensions are strongly recommended.
Download ZIP with the latest version from the master branch.
Copy filemanager.php to your website folder and open it in a web browser (e.g. http://yoursite/any_path/filemanager.php).
Default username/password: fm_admin/fm_admin
Warning! Please set your own username and password in $auth_users
before use.
To enable or disable authentication set $use_auth
to true
or false
.
For better security enable HTTP Authentication in your web server.
You can include file manager in another script. Just define FM_EMBED
and
other necessary constants.
The authentication does not work in emedded mode and it is expacted you use your own authentication/ authorisation mechanism!
Example:
class FileManagerController
{
public function runAction()
{
define('FM_EMBED', true);
// must be set if URL to manager is not equal to PHP_SELF
define('FM_SELF_URL', 'https://host/path/index.php?controller=FileManager&action=run';
// if document root location is different to filesystem
define('FM_ROOT_PATH', '/tmp'); // playground first!
require 'path/to/filemanager.php';
}
}
Supported constants:
FM_ROOT_PATH
- default is$_SERVER['DOCUMENT_ROOT']
FM_ROOT_URL
- default is'http(s)://site.domain/'
FM_SELF_URL
- default is'http(s)://site.domain/' . $_SERVER['PHP_SELF']
_FM_SELF_URL
- internal usage (to improve embedded usage)FM_ICONV_INPUT_ENC
- default is'CP1251'
FM_USE_HIGHLIGHTJS
- default istrue
FM_HIGHLIGHTJS_STYLE
- default is'vs'
FM_DATETIME_FORMAT
- default is'd.m.y H:i'
FM_SESSION_ID
- Session name and session key (default 'filemanager') to prevent conflicts
Public parameters/ actions in use (when using embedded you may need this info):
p
- filesystem path to usenew
- Create a new directorycopy
- Copy a file or directory srcmove
- Flag to move and not to copy a file or directoryfinish
- Flag to enable file/directory copy/movementsren
- Rename selected file or directoryto
- Rename targetdl
- Download selected filedel
- delete a file/ directorygroup
- Mass deletion of selected itemsdelete
group
- Pack selected itemszip
unzip
- Unpack selected itemtofolder
- Upack to folder of zip's filenamechmod
- Change mode (permissions) of selected itemview
- Show selected item (list zip contents, shows images/media or mime:text files)logout
- logout (if enabled)img
- Show a selected imageupl
- Flag for uploadsupload
- Upload _FILESfm_usr
- Login user (if auth enabled)fm_pwd
- Login pass (if auth enabled)
- PHP File Manager origin
- Tiny PHP File Manager with search and file editor
- simple php filemanager
If you have any issues with file manager, you may report them on Issue tracker.
This software is released under the MIT license.
Icons by Yusuke Kamiyamane.