Plugins for TFU/JFU/WFU

Since version 2.9 TFU does support that you can include and execute your own code after the upload. In TinyWebGallery e.g. the cache images are automatically created. You can e.g. write a log file or enter the upload data to your database.
You can also track downloads, deletes or any other file function since TFU 2.10.7. Check the log plugins for working implementations!

On this page you find all available plugins, how to install them and how to create your own plugins.

The plugins do work for TWG, TFU, JFU and WFU.

file uploader available plugin image Available plugins

PluginDescriptionDownload
E-mail
Version 1.1
The e-mail plugin replaces and enhances the internal e-mail notification for an upload. The default e-mail plugin sends an e-mail to the given address with a subject and a body where you can set 2 variables only.

With this plugin this now changes dramatically. You have now 17 variables available you can use in the subject and in the body of the e-mail. The body is now not a simple line anymore but a complete template where you can design text and also html e-mails. You are also able to send a 2nd e-mail to a different e-mail. The default for Joomla is the uploader itself.

Please read the readme.txt in the download. It contains the full documentation how the plugin can be configured.

file uploader e-mail plugin image
Download
Log
Version 1.1

The log plugin logs each upload, download and delete to the tfu.log file.

For each upload the file name, file path, the full path, the login and the description (if given) is stored. If you use Joomla and a user is registered you additionally get the user id, user name and the user e-mail.

Make sure the tfu folder is writeable!

Please note: The tfu.log has a maximum filesize of 2 MB. When the limit is reached the file is renamed to tfu.log.bak and a new log file is started. So you have a maximum of 4 MB of log data. If you need more please change the log file size or the implementation in tfu_helper.php (line 53 ff) or use the database plugin.

file uploader log plugin image
Download

Database log
Version 1.2

The database plugin logs each upload, download and delete to a database table.

For each upload the file name, file path, the full path, the login, upload time and the description (if given) is stored. If you use Joomla and a user is registered you additionally get the user id, user name and the user e-mail.
The database table is created automatically if it does not exist yet.

Setup:
  • TFU/WFU - Open the db_plugin.php and enter your database parameters in the file where you find the text
    // enter your db values below! (line 38ff.)
    'joomla_flash_uploader_log' is the default table name
     
  • Joomla - the Joomla db parameters are used. So you can use the plugin without any modification.
    '<dbprefix>joomla_flash_uploader_log' is the default table name.

Please check the debug file after installing the plugin. On some servers the plugin fails because sql.safe_mode is enabled. Please disable this on your server to allow that your database settings are used.

file uploader db plugin image
Download
Database log viewer
Version 1.1

The database log viewer is an enhancement for JFU 2.11 or newer where you can see the databes log in a nice sortable and pageabble view on the Info/Limits/Register page of JFU.

Flash upload view plugin image

Setup:

  1. Make sure to use at least JFU 2.11 - 2.10.x does not work anymore because of the different path since 2.11
  2. Download and install the database log plugin.
  3. Install the database log viewer to the tfu folder like described in the install section. Make sure that you extract everything with subfolders. You need to have the file db_plugin_view.php in the folder <tfu>/db_plugin.
  4. You can modify the columns if you like. Open the file <tfu>/db_plugin/db_plugin_view.php and modify the table in the bottom part of this file. You should have basic html and php knowledge to do this modification.

This plugin is for users with a professional edition license or above.

file uploader db viewer plugin image
Download
Cleanup
Version 1.1

This plugin deletes files if they are older than x days or if more than y files are in the upload folder. By default the upload dir of the user is used for cleanup. If you use this plugin and you are root be careful! You can cleanup your whole installation! Please edit the parameters in cleanup_plugin.php to configure this plugin.

file uploader cleanup plugin image
Download
Thumbnail
Version 1.0

The thumbnail plugin creates a thumbnail after the upload.

This plugin creates the thumbnail in the same folder. The file name for the thumb is the original file name plus '.thumb.jpg'. The internal resize function is used in the plugin. Therefore the file is first copied and resized afterwards.

file uploader download plugin image
Download
Prefix
Version 1.0

The prefix plugin adds a prefix to each uploaded file.

For each upload you can add a timestamp or e.g. the user name added to the file name.

Setup:
  • By default a timestamp is used: A file will e.g. get the prefix '20090829_' when it is uploaded at the 29.8.2009
     
  • If you want a different prefix please modify prefix_plugin.php. The plugin is prepared to add the login or if used in Joomla the user id, user name or user e-mail

Please note: The plugin file name is a_prefix_plugin.php. The reason is that this plugin changes the file name and plugins are executed in alphabetical order. This plugin should be executed first because otherwise other plugins use a wrong file name.

file uploader prefix plugin image
Download
Form
Version 1.0

The form plugin is an example how to get input elements from a HTML page where the flash is included.

You can use this plugin with the default tfu.htm page that comes with TFU. There the value of the language drop down is sent with the upload.
Set $form_fields = 'select'; in tfu_config.php and make sure you have at least a professional license. Then in the tfu.log you get the value of the drop down as last parameter.

Make sure the tfu folder is writeable!

file uploader form plugin image
Download
Move
Version 1.0
The move plugin moves the uploaded file to a fix folder. The folder can be set in the move_plugin.php in the variable $userdir. file uploader move plugin image
Download
Unzip
Version 1.0

This plugin extracts zip files right after the upload. The requirements for this plugin are PHP 5 >= 5.2.0 or PECL zip >= 1.1.0.

You can do the following settings in the unzip_plugin.php:

  1. Zip files are deleted right after the upload.
  2. The files are extracted to the upload directory or the file name is used as unzip directory.

If your server does not provide the needed classes a message is shown in the log file.

file uploader unzip plugin image
Download
Download Move
Version 1.1
The download move plugin moves a file after a download or all selected files after a zip download a fix folder. It moves it to the same path as the original below the $archivedir. Empty folders are removed. The folder can be set in the download_move_plugin.php in the variable $archivedir. E-Mail notification can be enabled by using a notification e-mail in the config. file uploader download move plugin image
Download
Approve
Version 1.0

By default this plugin moves a file to a subfolder called approve after the upload. This make it possible to do an easy approval process for uploads.

So when a users uploads a file e.g. to the folder "upload/user1" it is moved to the sub folder "upload/user1/approve" which is created automatically if possible. In TWG/TFU/JFU you can configure that certain directories (e.g. .svn) not shown. Add the approve directory to the directories that are not shown ($exclude_directories) in TWG/TFU/JFU. In TWG you can use the TWGExplorer to move the files back after approval. In JFU you can use a different profile where the directories are shown.

For advanced users: If you like different rights in TWG for the flash uploader I recommend to rename the folder to .approve and add this folder to the $exclude_directories in the additinal tab ($exclude_directories[]='.approve';). In TWG you can set the visibility of hidden files (files starting with a .) individually for each user. Make sure to use the latest version of TWG (at least 1.8.5 preview) because $hide_hidden_files is not connected to the TWGExplorer settings before in the front end. Then you have to edit admin/upload/my_tfu_config.php and set $exclude_directories again but without the .approve folder: At the bottom of my_tfu_config.php you find $exclude_directories[] = 'folder.id'; and change it to $exclude_directories = array('folder.id');

file uploader approve plugin image
Download
Download delete
Version 1.0
The download delete plugin deletes a file or if zip download is enabled all selected files after a download. E-Mail notification can be enabled by using a notification e-mail in the config. file uploader delete plugin image
Download
Watermark
Version 1.0
This plugin creates a watermark on each uploaded image. Please set the parameters in the plugin to change the settings. file uploader delete plugin image
Download

Feel free to extend any of the plugins to your needs.

file uploader install plugin image How to install plugins

Installing a plugin is really simple. Just extract the php file in the zip to the directory where the tfu_upload.php is located:

  • TFU -   main folder
  • JFU -   <Joomla main folder>/administrator/components/com_joomla_flash_uploader/tfu (since JFU 2.11: com_jfuploader)
  • WFU - <Wordpress main folder>/wp-content/plugins/wordpress-flash-uploader/tfu

Please check the description for the setup you have to do for some plugins. Feel free to extend any of the plugin to your needs.

Don't forget to delete your plugins before you uninstall JFU.

Plugins are executed in alphabetical order! If a plugin depends on other plugins (like the prefix plugin) take this into account if you create your own plugins.

flash uploader create own plugins image How to create your own plugins

Creating your own plugin is really simple. The tfu_upload.php looks for all files which end with _plugin.php. If you e.g. want to create a plugin that copies the file with ftp somewhere else a good name for the plugin would be ftp_plugin.php. You should use one of the existing plugins and modify to your needs.

ftp is now the name of the plugin and you can create the following functions depending when you want to do something. At your own functions you have to use the prefix of you plugin for your functions. In the example below ftp is used.

function ftp_plugin_process_upload_file($folder, $fullpath ,$filename) {
// is called after the upload
}

/* optional for file operations before file methods are called */
function ftp_plugin_process_file($action, $fullpath, $folder) {
// is called before the files functions are executed - See tfu_file.php for available actions.
}

/* optional for file operations after file methods are called - available since 2.12 */
function ftp_plugin_after_process_file($action, $fullpath, $folder) {
// is called after the file functions are executed - See tfu_file.php for available actions.
}

Just check the existing plugins as examples. This function is called by tfu_upload.php after the upload or by tfu_file.php. The available parameters are:

  • $folder - relative folder the file is uploaded too.
  • $fullpath - the full path to the file - use this to copy the file somewhere.
  • $filename - the name of the file.
  • $action - the performed action - e.g. delete. See tfu_file.php for available actions.

In the session and in the request are some more data you might want to use:

$username = (isset($_SESSION['TFU_USER'])) ? $_SESSION['TFU_USER'] : $_SERVER['REMOTE_ADDR'];
$description = (isset($_GET['description'])) ? $_GET['description'] : '';

If you want to check if this is the last file of the upload use:

global $remaining;
if ($remaining == 0) {
// do whatever you want at the last upload
}

If you have a post upload window you get the data here:

$_SESSION['TFU_PRE_UPLOAD_DATA']

If you need a list of the files uploaded in this upload so far:

$_SESSION['TFU_LAST_UPLOADS']

If you need any of the parameters from the config please use the global statement.

The next 3 values only available if you use Joomla and a user is registered:

$userid = (isset($_SESSION['TFU_USER_ID'])) ? $_SESSION['TFU_USER_ID'] : '';
$userdisplayname = (isset($_SESSION['TFU_USER_NAME'])) ? $_SESSION['TFU_USER_NAME'] : '';
$useremail = (isset($_SESSION['TFU_USER_EMAIL'])) ? $_SESSION['TFU_USER_EMAIL'] : '';
$isbackend = isset($_SESSION['IS_ADMIN']);

Make sure that each plugin contains this line at the top to make sure noone else can call the plugin:

defined('_VALID_TWG') or die('Direct Access to this location is not allowed.');

If you have written a plugin that is maybe useful for others please send it to me. I will include it to this page.

esta-registration.co.uk