Configurable Download

Download manual.zip

Download private_file.zip

The system is capable of providing public or subscription files for download.

The catalog /examples/download/ contains an example of downloading a public file and registering the download event in the Statistics module. All download files reside in /examples/download/files/. However, /files/ is not added to a download URL. When a visitor clicks the link, the system calls the 404 error handler specified in .htaccess of a current folder. In this example, the file is download.php.

This folder also contains the script download_balance.php. It balances downloads between multiple servers. The folders /download/ must be identical and have the same structure and files, on all servers. To activate the autobalancing script, do the following.

  1. Edit .htaccess and specify download_balance.php as the 404 error handler.
  2. Uncomment $arrHOSTS in download_balance.php and set the URL's of download servers and the server selection probability.

If you want the system to allow unauthorised downloads, create a file .access.php in the site root, and type the following directive in it:
<? $PERM["/"]["*"]="R"; ?>

The catalog /examples/download/download_private/ contains files illustrating the implementation of downloading private files and registering the download event in the Statistics module.

All files are stored in /examples/download/download_private/files/; the download URL's have the format <a href="/examples/download/download_private/private_file.zip"> private_file.zip</a> (without /files/).
Parameters of the script are set so that registered users only are allowed to download files in this catalog. Only registsred users can access file in /files/. download_private.php is called as the 404 error handler.

Bitrix Site Manager