Project

General

Profile

SYSTEM-DIALOG GET-FILE AT-WEB-BROWSER UPLOAD

Display a file dialog in the web browser's interface.

FWD History

The original SYSTEM-DIALOG GET-FILE support was implemented in #1830. The AT-WEB-BROWSER and UPLOAD options were added as FWD-specific enhancements in #4113.

With the possibility to deploy 4GL applications on the web with FWD a new option was added to the statement SYSTEM-DIALOG GET-FILE to allow a user to select files from the system where the web browser executes. This option - AT-WEB-BROWSER - will show a native HTML dialog for selecting local files. The use of the native HTML is required to satisfy the security limitations involving file system operations from the browser.

As of trunk revision 15315, there is an improved mechanism for browser uploads. This new mechanism is the WEB-FILE-UPLOAD Statement. It requires more 4GL code changes to implement than these modifications to SYSTEM-DIALOG GET-FILE.

Syntax

SYSTEM-DIALOG GET-FILE mycharactervariable [MULTIPLE] [AT-WEB-BROWSER [UPLOAD [DIR "/tmp"]]]

Where:

  • mycharactervariable
    • This is an OUTPUT variable which will either be assigned the file name of the selected file when UPLOAD is not given or to the absolute file path of the uploaded file on the FWD client system with UPLOAD specified.
    • When MULTIPLE is also present in the statement, mycharactervariable will be a comma separated list of entries.
    • There is no way to get to the absolute file path of the selected file on the system where the web browser executes. This is due to the security limitations implemented by modern web browsers.
  • MULTIPLE - (optional) Enables multiple files to be selected in the file-selection dialog.
  • AT-WEB-BROWSER (optional)
    • Enables a browser dialog on the user's system instead of showing a FWD dialog that allows the selection of files on the FWD client (which is usually a remote cloud system).
    • UPLOAD [DIR "path"] (optional) Will cause the selected file(s) to upload so that the file content will be made available for the 4GL application.
      • When DIR is specified:
        • Its lvalue will be used as the upload directory on the file system where FWD client process executes.
        • If the same file already exists in the target upload directory the file will be silently overwritten with the selected file.
      • When DIR is missing:
        • The upload directory will be calculated as <os_temp>/fwd-upload where os_temp is the system temp directory as given by the java.nio.file.Files.createTempDirectory() standard Java method.
        • A unique upload directory is calculated for every selected file, even if the same file is uploaded multiple times.

Supported Options

TITLE, UPDATE and IN WINDOW options are supported and will behave according to the standard 4GL language statement.

Unsupported Options

Some of the standard SYSTEM-DIALOG GET-FILE options are not supported at this time and will not have any effect when used together with AT-WEB-BROWSER. These are:

  • ASK-OVERWRITE
  • CREATE-TEST-FILE
  • DEFAULT-EXTENSION
  • FILTERS
  • INITIAL-DIR
  • INITIAL-FILTER
  • MUST-EXIST
  • RETURN-TO-START-DIR
  • SAVE-AS
  • USE-FILENAME

Size Limitations

It may be important to enforce limits on the sizes of files allowed to be transferred over the network. This can be done using directory options in the webClient section. This feature was added in #4113.

Parameter Description
uploadSingleFile the maximum size allowed for uploaded files
uploadTotalFiles the maximum size allowed for multipart/form-data requests
fileSizeThresholdForDiskWriting the size threshold after which files will be written to disk

Example

    <node class="container" name="server">
      <node class="container" name="default">
        <node class="container" name="webClient">
          <node class="string" name="uploadSingleFile">
            <node-attribute name="value" value="200M"/>
          </node>
          <node class="string" name="uploadTotalFiles">
            <node-attribute name="value" value="1000M"/>
          </node>
          <node class="string" name="fileSizeThresholdForDiskWriting">
            <node-attribute name="value" value="2M"/>
          </node>

© 2019-2022 Golden Code Development Corporation. ALL RIGHTS RESERVED.