Debian - Self-hosted Web File Transfer with FileZ



debian-filez-logoFileZ is a Web file transfer project started by French university of Avignon.

It provides a simple and efficient way to upload and manage very big files that you want to share over internet. Everything is stored on your web server and handled through a web interface and some unique URLs.

University of Avignon has stopped to maintain the project, but it is still maintained by a small core team under Github repository

FileZ main features are :

  • handling of files up to 2 Gb
  • generation of short URL to retrieve these files
  • multiple users management with quotas
  • time limit and/or password management for files

Even if it is very simple to use, it is quite difficult to install. In fact, the project environment has evolved quite a lot but the provided installation procedure has not followed. As a result, whatever installation guide you find on the web is very much outdated.

So, this guide explains step by step procedure to fully install latest FileZ version 3.0 alpha from on a Debian 7.0 server. It uses a MySQL database to manage users.

Many thanks to Akim Bourenane for pointing out and testing this very nice tool and to Gijs Hillenius for his very wise suggestions.

1. Pre-requisite

Before going further, make sure that you have the following requirements on your Debian server :

  • a running LAMP (Apache 2 / PHP 5 / MySQL 5) installation
  • module mod_rewrite installed
  • a console root access to your server

GIT client should also be installed :

# apt-get install git

If everything is available, you can go ahead.

This article supposes that your web site root is under /var/www. If this is not the case, you will have to adjust some paths.

2. Progress Dialog Libraries

debian-filez-progressbarFileZ is using some progress bar while uploading files.

To allow Apache2 web server to display this type of progress bar, you need to setup some specific libraries.

Here are the steps in console mode to install and declare all the needed libraries under Debian :

# apt-get install php5-dev php-apc
# pecl install uploadprogress

# echo "apc.rfc1867=1" >> /etc/php5/mods-available/apc.ini
# ln -s /etc/php5/mods-available/apc.ini /etc/php5/apache2/conf.d/20-apc.ini

# echo "" >> /etc/php5/mods-available/uploadprogress.ini
# ln -s /etc/php5/mods-available/uploadprogress.ini /etc/php5/apache2/conf.d/20-uploadprogress.ini

# apache2ctl restart

3. Directory Structure Creation

FileZ needs some specific directories for it own use :

directory usage 
 /var/filez/uploads  place to store uploaded files
 /var/log/filez  message logs (filez.log & filez-error.log)

Theses directories need to be created and should be accessible by www-data user :

# mkdir -p /var/filez/uploads
# chown -R www-data:www-data /var/filez
# mkdir -p /var/log/filez
# chown -R www-data:www-data /var/log/filez

4. Virtual Host Configuration

Before running the web installation procedure, you need to setup your Apache 2 virtual host for the FileZ web folder.

Some specific configuration parameters are needed by FileZ :

  • AllowOverride All
  • PHP upload maximum sizes (1 Gb here)
  • PHP timeouts (30 min = 1800 seconds)
  • PHP upload temporary directory

This configuration should be done for the xfer sub folder where your FileZ instance is installed :


<VirtualHost ...>

  <Directory /var/www/xfer/>
    AllowOverride All
    Order allow,deny
    Allow from all
    php_admin_value upload_max_filesize  1000M
    php_admin_value post_max_size        1000M
    php_admin_value max_input_time       1800
    php_admin_value max_execution_time   1800
    php_admin_value upload_tmp_dir "/var/www/tmp"

Make sure to enable your site (if not already done) and to restart Apache :

# a2ensite yoursite
# service apache2 restart

5. Database Creation

Prior to installing FileZ, we need to create a filez database that FileZ instance will use. This database should be created with a filez user having full access to it.

This filez user will be used during FileZ Web installation procedure. You need to modifiy password with your own user password.

As we want to manage users in the FileZ database (not through any LDAP server), we also have to manually create a table fz_user.

This table will handle all FileZ declared users. It's structure is specific. It needs to handle quotas introduced in latest version of FileZ.

This database structure can be created thru command lines :

# mysql -u root -p
mysql> CREATE DATABASE filez CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> USE filez;
mysql> CREATE TABLE 'fz_user' ('id' SERIAL NOT NULL, 'username' VARCHAR( 30 ) NOT NULL, 'password' VARCHAR( 40 ) NOT NULL, 'salt' VARCHAR( 40 ), 'firstname' VARCHAR( 50 ) NOT NULL, 'lastname' VARCHAR( 50 ) NOT NULL, 'email' VARCHAR( 50 ) NOT NULL, 'quota' VARCHAR( 20 ) NOT NULL, 'is_admin' BOOLEAN DEFAULT 0, 'created_at' TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE = MYISAM ;
mysql> GRANT ALL PRIVILEGES ON filez.* To 'filez'@'localhost' IDENTIFIED BY 'password';
mysql> exit

The minimal database structure is now setup to be used by your FileZ instance.

6. Installation of latest FileZ package

We can now retrieve latest FileZ version from the GIT repository.

We will install it at the root of the default web site in a /xfer sub-folder.

We will also create the tmp directory that will be used by FileZ.

# git clone /var/www/xfer
# chown -R www-data:www-data /var/www/xfer
# mkdir /var/www/tmp
# chown -R www-data:www-data /var/www/tmp

The FileZ site is now accessible.

7. First Connexion

Everything is now ready to do the first connexion by connecting with a browser to

You'll go thru a configuration screen that should confirm that your virtual host PHP parameters (size, time, temporary folder) are taken into account.

Next screen will allow you to setup the complete web configuration parameters.

Main parameters to define are :

  • General - fill up your own Filez administor email
  • General - Select PECL::ProgressMonitor as Upload progress monitoring library
  • Email (SMTP) - Configure with your SMTP mail server.
    If you are using a gmail account, follow this Sendmail setup for Gmail tutorial and then configure SMTP Host as localhost and Authentification method as anonymous.
    All FileZ mails will be sent using your default Gmail account.
  • FileZ database - fill-up Database Password with the password you've previously declared for filez MySQL user
  • Authentification - Select Internal database
  • Identification - Select Database
  • Identification - Tick Use the same configuration as Filez

If you want to add your logo and your own CSS style :

  • place your logo under /xfer/resources/images/yourlogo.png
  • place your CSS under /xfer/resources/css/yourstyle.css
  • UI customisation - fill URI for logo image
  • UI customisation - fill URI for CSS file

In both fields, start path from /resources/... (do not start with /xfer, as it is your instance root).

You can now validate the configuration page.

If everything goes fine, you should get a success message and be brought to the admin user page.

A configuration file has been created under /var/www/xfer/config/filez.ini.

8. Initial Configuration

From the Web interface, next step is to go in the Administration section and :

  • modify default admin password
  • setup admin email address
  • create other users

To be on the safe side, avoid to use admin account for anything else than administration tasks.

If you are planning to deposit files, prefer to use another account for that purpose.

9. Cleanup of Expired Files

FileZ provides a cleaning mechanism for expired files.

It is triggered every time you call page.

It's main role is quite simple :

  • two days before a file expires, a notification email is sent to the owner
  • when one file has expired, it is deleted and the owner receives a notification email

This URL should be called every day and it appends data to specific log files.

A sample script is provided under xfer/scripts/, but it needs to be adapted for our Debian environment. Script should be placed under /etc/cron.daily :


# -----------------------------------------------------------------------------
# FileZ cron job used to delete expired files.
# History :
#   24/10/2013 - Creation by N. Bernaerts
# -----------------------------------------------------------------------------

# Url of filez web root

# cleanup URL
URL_RESULT="`wget --header=\"Accept-Language:en\" -nv -O - $URL_ROOT/admin/checkFiles 2>&1`"

# log result
LOG_DATE="`date +'%F %T'`"
echo $LOG_DATE Execution of FileZ cleanup script >> /var/log/filez/filez-cron.log
echo $URL_RESULT >> /var/log/filez/filez-cron.log

It should be executable and can be launched once as root to make sure everything works.

# chmod +x /etc/cron.daily/filez-cleanup
# /etc/cron.daily/filez-cleanup

Execution should be logged in /var/log/filez/filez-cron.log.


You can now enjoy your self-hosting FileZ web file transfer server.

Hope it helps.

Signature Technoblog

This article is published "as is", without any warranty that it will work for your specific need.
If you think this article needs some complement, or simply if you think it saved you lots of time & trouble,
just let me know at This email address is being protected from spambots. You need JavaScript enabled to view it.. Cheers !

icon linux icon debian icon apache icon mysql icon php icon piwik icon googleplus