Usage
Extract the files to your webserver and adapt the configuration (config.inc.php) to
your needs. You can change FTP settings and the data directory there and enable or disable file
upload/download, renaming, editing, etc. It's possible to let FileManager automatically replace
spaces in filenames with underscores or convert filenames to lowercase or call a specific URL when
uploading or downloading files.
Please make sure that PHP has write permission for FileManager's tmp directory and its
sub-folders.
FileManager supports the following languages:
|
Bulgarian |
- |
lang_bg.inc |
|
Catalan |
- |
lang_ca.inc |
|
Chinese (simplified) |
- |
lang_zh-Hans.inc |
|
Chinese (Taiwan) |
- |
lang_zh-TW.inc |
|
Czech |
- |
lang_cs.inc |
|
Danish |
- |
lang_da.inc |
|
Dutch |
- |
lang_nl.inc |
|
English |
- |
lang_en.inc |
|
Estonian |
- |
lang_et.inc |
|
Finnish |
- |
lang_fi.inc |
|
French |
- |
lang_fr.inc |
|
German |
- |
lang_de.inc |
|
Greek |
- |
lang_el.inc |
|
Hebrew |
- |
lang_he.inc |
|
Hungarian |
- |
lang_hu.inc |
|
Italian |
- |
lang_it.inc |
|
Latvian |
- |
lang_lv.inc |
|
Norwegian |
- |
lang_no.inc |
|
Persian |
- |
lang_fa.inc |
|
Polish |
- |
lang_pl.inc |
|
Portuguese |
- |
lang_pt.inc |
|
Portuguese (Brazil) |
- |
lang_pt-BR.inc |
|
Romanian |
- |
lang_ro.inc |
|
Russian |
- |
lang_ru.inc |
|
Spanish |
- |
lang_es.inc |
|
Swedish |
- |
lang_sv.inc |
|
Turkish |
- |
lang_tr.inc |
If you want to translate it into your language, the language file must be saved as UTF-8
without BOM. Don't forget to send
me a copy! :-)
If you want to use FileManager as a stand-alone software, just open
filemanager.php with your favorite browser - that's all, have fun. ;-)
However, if you want to integrate FileManager into your website like I did in the
introduction section, please read this little tutorial. It
implies however that you have basic knowledge of PHP programming.
You will need the FileManager class. It should be included at the very beginning of your PHP
file, because it will start a session if there's no session started already. Replace
[pathToFileManager] with the directory path where you installed FileManager:
<?php
include_once('[pathToFileManager]/class/FileManager.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
...
Now create an instance and call the create() method anywhere within your PHP file:
$FileManager = new FileManager();
print $FileManager->create();
That's it. But wait, there's more. You can also set a data directory - this overrides
the settings in config.inc.php:
$FileManager = new FileManager('/home/users/gerry/htdocs');
print $FileManager->create();
By the way, you can create as many instances of the FileManager class as you want, assign
different data directories and change other settings like this:
$FileManager1 = new FileManager('/home/users/gerry/music');
$FileManager1->fmView = 'details';
print $FileManager1->create();
$FileManager2 = new FileManager('/home/users/gerry/photos');
$FileManager2->fmView = 'icons';
print $FileManager2->create();
Please have a look at the config.inc.php file if you want to know which variables
are available. All of them can be modified either in the config file or dynamically at
runtime. Please note that while boolean variables in the config file are set to "yes" or
"no", they must be set to "true" or "false" when modified at runtime. Example:
$FileManager->enableUpload = false;
$FileManager->hideSystemType = true;
Comma-separated lists can also be defined as array when modified at runtime:
$FileManager->hideColumns = array('owner', 'group', 'permissions');
Of course all settings must be done before the create() function is called!
If you're still not quite sure how to integrate FileManager into your website, just have
a look at the source code of filemanager.php.
User Management
FileManager does not have a user management, because it is very easy to integrate it into
your website and your own existing user management. But it is possible to set passwords and
data directories for several users, if this is all that you need. Just set the
loginPassword variable either in the config file or at runtime like in this example:
$FileManager = new FileManager();
$FileManager->loginPassword = array(
'myPwd1::/home/users/peter/htdocs',
'myPwd2::/home/users/paul/htdocs',
'myPwd3::/home/users/mary/htdocs'
);
print $FileManager->create();
This works in local mode and in FTP mode.
The Perl Uploader
If you want to use the integrated Perl uploader, first make sure that the uploadEngine
variable in FileManager's configuration file is set to "Perl", or set it at runtime (see examples
above). If your Apache server reads .htaccess files and the setting of options is allowed,
then no webserver configuration should be necessary. Otherwise, ask your server administrator to
allow script execution in FileManager's cgi directory. Here's an example for Apache servers:
<Directory "/path/to/filemanager/cgi">
Options +ExecCGI
</Directory>
AddHandler cgi-script .cgi .pl .prl
Also make sure that the Perl scripts in the cgi directory are saved as ASCII files and
that they have proper read and execute permissions.
Hooks
FileManager provides hooks for upload and download, i.e. whenever a file is uploaded or downloaded,
a specific URL can be called by using these hooks. File path, file size and referer IP address
(if available) will be sent as parameters named file, size and ip. You can
use the uploadHook and downloadHook variables in the config file. Your hook script
could look like this:
<?php
$file = $_GET['file'];
$size = $_GET['size'];
$ip = $_GET['ip'];
$logFile = '/home/users/gerry/logs/upload_' . date('Ymd') . '.log';
if($fp = fopen($logFile, 'a')) {
fwrite($fp, sprintf("%s %s %s %d\n", date('Y-m-d H:i:s'), $ip, $file, $size));
fclose($fp);
}
?>
Remember, this is just an example. Instead of writing a log file, you could for instance store
the information in a database, send a message, run another application, etc.
Custom Action
You can set a JavaScript function as custom action when a file is clicked. It will also be added
to the context menu. Here's an example for the config file setting:
customAction = "{caption: 'My custom action', action: 'myCustomAction'}"
The function itself should look like this:
function myCustomAction(containerId, fileId, fileName) {
...
}
Container ID, file ID and filename will be passed by FileManager. Please note that the filename does
not contain a full path for security reasons and because FileManager can be used with FTP accounts.
However, if you set the variable hideFilePath in the config file to "no", the filename will
contain the full path starting in FileManager's data directory:
hideFilePath = no
Comments
|