Upload Files

Some forms contain file fields that allow you to upload files. A file field is defined by an <input>-tag of type file, such as the following:

     <INPUT type="file" name="attachedFile">

In the Select File action, there are two ways to upload a file using a file field.

  1. The first way is to upload a file from the file system. To do this, select File in Local File System from the list and enter the file name. When the form is submitted, the specified file is loaded from the file system and uploaded as part of the form submission.

    The file name must be an absolute file name, including the drive name, if any, and the directory path to the file.

  2. The second and most common way to upload a file is to specify the file contents to upload, instead of loading the file from the file system. To do this, select File Contained in Variable from the list. Then, you may select the variable that holds the file contents from the File Content list. Typically, you get the contents from either a binary variable in which you have downloaded the file earlier using the Extract Target action, or from a variable containing text that you have extracted earlier.

Optionally, you can specify the content type and the file name of the file. The content type should be the MIME type of the contents, optionally followed by a charset. You may use one of the predefined content types, acquire it from an attribute or specify a custom content type. For example, the content type could look like this for an image:

     image/gif

and like this for a plain text:

     text/plain; charset=iso-8859-1

Note that when downloading files using Extract Target, you can store the content type and file name of the downloaded data in other variables. You can then use this information when uploading the file with the Select File action.