fgl_putfile()

Transfers a file from the virtual machine context to the front-end context.

Syntax

fgl_putfile(
   localPath STRING,
   remotePath STRING)
  1. localPath is the path to the file to transmit from the virtual machine context.
  2. remotePath is the path to the file to write on the front-end workstation file system. This parameter is ignored when the front-end is GAS + GBC in a web browser.

Usage

The fgl_putfile() function downloads a file from the application server disk where fglrun is executed to the front-end workstation disk.

Important:

Using this function can result in a security hole if you allow the end user to specify the file paths without control. There is no limitation on the file content or file paths. If the user executing the application on the server side is allowed to read critical server files, the program could transfer these files on the client workstation. On the other hand, critical files can be written on the client workstation. It is in the hands of the programmer to implement file path and/or file content restrictions in the programs using fgl_putfile().

When using the GAS/GBC front-end, the remotePath parameter is ignored, because browsers cannot directly write to the disk for security reasons. The basename of the filename specified in the localPath parameter will be the name of the file to be downloaded. For example, when performing the following call:
CALL fgl_putfile("/var/myapp/files/myfile.txt", "dummy")

The "myfile.txt" basename of the source filename will be used to create the local file, in the browser download directory.