Enable file upload/download in LyciaWeb

LYCIA


To enable file upload/download in Lycia Web, use the FileUpload predefined class.

You may also want to check fgl_download() and fgl_upload() built-in functions.

4GL code sample:

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 sample:

<?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>