This topic highlights basic concepts which you need to grasp to start using File Downloader.

Steps to Use File Downloader

To integrate File Downloader with your website, you always need to do the following steps:

  1. Copy FileDownloader7.cab, FileDownloader7_x64.cab, and FileDownloader7.jar to your Web server where the website is running.
  2. Link the helper iuembed.js script and add File Downloader to a Web page where you want to use this control.
  3. Prepare a file list that will be downloaded by File Downloader. The file list can be either a static file or a dynamic page that returns the list as plain text.
  4. Configure File Downloader parameters.

Adding File Downloader to a Web Page

File Downloader is not a standalone application. It can be interpreted as a "browser add-on" that should be embedded into a page. Here is how to do it.

First, you need to install File Downloader SDK. This SDK contains documentation, demo applications, and redistributable files:

  • FileDownloader7.cab
  • FileDownloader7_x64.cab
  • FileDownloader7.jar
  • iuembed.js

File Downloader SDK can be downloaded from the following location: http://www.aurigma.com/downloads/file-downloader. Here the SDK is available in the following packages:

  • FileDownloader.exe, Windows-only installer
  • FileDownloaderNoSetup.zip, ZIP archive

If you downloaded the Windows-only installer, just run the FileDownloader.exe file and follow the wizard steps. During one of these steps you specify the folder where to install all File Downloader SDK files. Typically this is C:\Program Files\Aurigma\File Downloader 7.0.9\; you will find all necessary files there.

Use FileDownloaderNoSetup.zip for non-Windows platforms. Unpack this archive into any folder on your computer to get SDK files.

After installation, add the control to your Web page. As File Downloader is provided along with the special helper JavaScript file called iuembed.js, and this script functions are used to invoke and configure the control, do the following.

  1. Copy the following files to the folder on your Web server, where the required Web page is located:
    • FileDownloader7.cab
    • FileDownloader7_x64.cab
    • FileDownloader7.jar
    • iuembed.js
  2. Link iuembed.js with the required Web page by inserting the following line in the beginning of this page:

    JavaScript

    <script type="text/javascript" src="iuembed.js"></script>
  3. Add File Downloader to the page by inserting the following JavaScript block:

    JavaScript

    <script language="javascript">
    // Create an instance of FileDownloaderWriter
    var fd = new FileDownloaderWriter("FileDownloader", 122, 44);
    
    // A path to the CAB file (including the file name)
    fd.activeXControlCodeBase = "FileDownloader7.cab";
    // A path to the x64 CAB file (including the file name)
    fd.activeXControlCodeBase64 = "FileDownloader7_x64.cab";
    // Version of the CAB file
    fd.activeXControlVersion = "7,0,10,0";
    
    // A path to the JAR file
    fd.javaAppletCodeBase = "./";
    // A file name of the JAR file
    fd.javaAppletJarFileName = "FileDownloader7.jar";
    // Version of the JAR file
    fd.javaAppletVersion = "7.0.10.0";
    
    // ... Initialize parameters as described in the 'Configuring File Downloader'
    // section below ...
    
    // As soon as you call this method, all necessary HTML code is inserted into
    // the page at the current position. Alternatively, you can get the string with
    // appropriate HTML code using the getHtml method, and write it to the
    // necessary position manually (maybe with some modifications). 
    fd.writeHtml();
    </script>
    Note

    If you encounter problems loading File Downloader, make sure that:

    • The CAB file location corresponds to the URL specified with the activeXControlCodeBase property.
    • The x64 CAB file location corresponds to the URL specified with the activeXControlCodeBase64 property.
    • The version of the CAB file is equal to the activeXControlVersion property value.
    • The JAR file location corresponds to the URL specified with the javaAppletCodeBase property.
    • The JAR file name is equal to the javaAppletFileName property value.
    • The version of the JAR file is equal to the javaAppletVersion property value.

If you prefer not to use Java or ActiveX version of File Downloader, you should disable it using the corresponding property (FileDownloaderWriter.activeXControlEnabled or FileDownloaderWriter.javaAppletEnabled). The following sample disables the Java version of File Downloader, as a result non-Internet Explorer browsers become unsupported by File Downloader:

JavaScript

<script language="javascript">
// Create an instance of FileDownloaderWriter
var fd = new FileDownloaderWriter("FileDownloader", 122, 44);

// A path to the CAB file (including the file name)
fd.activeXControlCodeBase = "FileDownloader7.cab";
// A path to the x64 CAB file (including the file name)
fd.activeXControlCodeBase64 = "FileDownloader7_x64.cab";
// Version of the CAB file
fd.activeXControlVersion = "7,0,10,0";

// Disable Java version of File Downloader
fd.javaAppletEnabled = false;

//...other parameters...

fd.writeHtml();
</script>

Preparing a File List

The next step you need to complete is to prepare a list of downloadable files. The file list is a plain text file. Each entry in this list corresponds to one file and takes up exactly one line. The entry consists of four fields separated by pipes (|). These fields represent:

  1. MIME type of the file.
  2. Size of the file. Specifying the file size is optional; to ignore it set the parameter to 0.
  3. Name of the file for saving on the user's computer. This field can optionally contain subfolders that will be created before saving the file.
  4. URL from which the file will be downloaded.
Note

The order of fields in the entries is important.

Here is a sample file list.

image/jpeg | 174546 | apples.jpg | http://localhost/Fruits/apples.jpg
image/jpeg | 134257 | apricots.jpg | http://localhost/Fruits/apricots.jpg
image/png | 545675 | avocados.png | http://localhost/Fruits/avocado.png

The file list can be a simple static file or can be generated by a server script on request. The latter approach is used in our samples (see the Samples topic). If the static file is sufficient for your needs, put it somewhere on your Web server.

Configuring File Downloader

File Downloader has a number of parameters, but some of them are essential for the proper work of the control, and some are simply intended for customization. In this section we will breifly overview the most important parameters.

The most important parameters are:

To specify these parameters add the following lines in the JavaScript block listed above. Note that the lines should be added before the fd.writeHtml() instruction.

JavaScript

<script language="javascript">
var fd = new FileDownloaderWriter("FileDownloader", 122, 44);

//...other parameters...

fd.addParam("FileList", "http://localhost/filedownloader/filelist.txt");
fd.addParam("LicenseKey", "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXXX");
fd.addParam("ButtonDownloadText", "Download Files");

//...other parameters...

fd.writeHtml();
</script>

You can learn more about these and other properties in the FileDownloader Class Members and Helper Script Reference (iuembed.js) topics.

Now you can test the Web page with File Downloader.

Where to Find Code Samples

File Downloader is distributed with a number of demo applications which can be used as code samples. You can find them in the installation folder of File Downloader.

Samples are available for the following platforms:

Where to Find Other Information

Below you will find a number of useful links related to File Downloader.

File Downloader Online Demo

Online demo of File Downloader. You can use it if you want to see File Downloader in action without installing demo applications on your machine.

Deployment Notes

Information on how to deploy File Downloader on the production server.

Evaluating and Registering File Downloader

Information on how to use license keys obtained upon purchase to remove limitations of the evaluation version.

FileDownloader Class Members

List of all FileDownloader class members. It will be useful when you start configuring File Downloader parameters.

Helper Script Reference (iuembed.js)

Reference and programmer's guide to the helper iuembed.js script. It is highly recommended to familiarize yourself with this topic before you start editing the File Downloader-related client-side code.

Using File Downloader

Root topic for the File Downloader manual, which contains a number of articles demonstrating how to use File Downloader for different tasks.