APPX Software Library

Chapter 4-7: Predefined Fields and Processes

GET FILE FROM CLIENT

This subroutine retrieves a file from the client system and stores it on the server. Three arguments are expected to be passed to the subroutine:

  • Source pathname (alpha field, maximum length 256)
  • If blank, the client will open a dialog browser so the user can select the file.
  • Should be PASS'ed shared to allow for return of user-selected file.
  • If the source pathname is relative, it will be relative to the location of the APPX client jar file.
  • Destination pathname (alpha field, maximum length 256)
  • Field for status indicator (numeric field)
  • Must be PASS'ed shared.
  • Returns status code (0=Failure, 1=Success).

The subroutine can be invoked via SUBR or GOSUB. While the file is in transit, the client will show a progress slider and the APPX session will wait until it completes before returning.

The following example retrieves a user-selected file from the APPX client and stores it on the APPX server. It displays a message (or warning) reporting the name of the file the user selected and whether or not it was retrieved successfully.

          SET      --- TEMP 132                   =
          SET      --- TEMP 256                   =      /tmp/testfile.txt
          SET      --- XI                         =      0
          *
          PASS     --- TEMP 132                   FIELD            SHARE? Y
          PASS     --- TEMP 256                   FIELD            SHARE? N
          PASS     --- XI                         FIELD            SHARE? Y
          SUBR     --- GET FILE FROM CLIENT             DETACHED     END? N  FAIL 0
          *
          IF       --- XI                         EQ     1
    T     APPEND   --- TEMP 132                   1      retrieved OK
    F     APPEND   --- TEMP 132                   1      not retrieved
    -     APPEND   --- TEMP 132                   1      from client
    T     MESSAGE  --- TEMP 132
    F     WARNING  --- TEMP 132