How to upload file from application server?

For using upload/download file functionality in LW you should use “FileUpload” predefined class.

Information you may also needed information about fgl_download() and fgl_upload() built-in functions.

Here is the example:

4GL code:

MAIN
     DEFINE f1 CHAR(100)
          OPEN WINDOW w1 WITH FORM "fgl_upload_download_lw" ATTRIBUTE(BORDER)
          INPUT BY NAME f1
               AFTER FIELD f1
                    NEXT FIELD f1
               ON ACTION "UPLOAD"
                    CALL fgl_dialog_update_data()
                    CALL fgl_upload(f1, fgl_basename(f1))
                    IF os.Path.isfile(fgl_basename(f1)) THEN DISPLAY "TRUE" ELSE DISPLAY "FALSE" END IF
               ON ACTION "DOWNLOAD" 
                    CALL fgl_download(f1,fgl_basename(f1))
          END INPUT
END MAIN

Form code:

<?xml version="1.0" encoding="UTF-8"?>
 <form xmlns="http://namespaces.querix.com/2015/fglForms" >
 <form.rootContainer>
 <CoordPanel preferredSize="414,135" minSize="414,135" visible="true" enable="true" fieldTable="formonly" identifier="rootContainer">
 <TextField classNames="FileUpload" location="168,22" preferredSize="216,22" visible="true" enable="true" fieldTable="formonly" identifier="f1"/>
 <Label isDynamic="true" text="Upload Path to Progs:" location="0,22" preferredSize="168,22" visible="true" enable="true" fieldTable="formonly" identifier="lb2"/>
 </CoordPanel>
 </form.rootContainer>
 <form.screenRecords>
 <ScreenRecord identifier="FormOnly" fields="f1"/>
 </form.screenRecords>
 </form>

Click the link below to see
all KB articles by product.