This API initiates a download from a file in the Integrated File System (IFS) to the browser. 

In order to use this API, you must first set up the security for it by creating a PUI Download Exit (PUIDNLEXIT) program.  Click here for details on how to create a PUIDNLEXIT program.

Parameters:

Configuration Options

Examples:

The following example downloads a PDF file from the /usr/share/accounting directory of the IFS. The user will be prompted to save this document to disk, because it was not specified as "inline":

pui.download({ "id":  "/usr/share/accounting/invoice12345.pdf" });

This example downloads a product image to be displayed in a new window in the browser:

pui.download({ "id":  "/images/products/54321.jpg", "inline": true, "contentType": "image/jpeg" });

This example passes "itemrpt" to the PUIDNLEXIT program. PUIDNLEXIT will have code in it to look for the "itemrpt" string, and then will generate a PDF of an item report, store it in a temporary file, and download it to be displayed in the browser. After the download is complete, PUIDNLEXIT will delete the temporary file. (Most of the needed logic is in the download program. See PUIDNLEXIT for details.)

pui.download({ "id":  "itemrpt", "inline": true, "contentType": "application/pdf" });

Inline Usage

To perform a download so that it specifies a URL to be used as an "image source" or similar, see the pui.downloadURL() API