The fgl_file_dialog() function returns a semicolon-separated list of names of the files to upload. On the next step, fgl_upload() should use these file names as parameters.
The extended mode of fgl_file_dialog() is enabled by adding the full-upload-info class to the application:
CALL ui.Application.GetCurrent().SetClassNames(["full-upload-info"])
In this case, the fgl_file_dialog() returns a JSON string that can be parsed into array of objects:
MAIN
DEFINE filenames STRING
DEFINE i INTEGER
DEFINE ja util.JsonArray
DEFINE jo util.JsonObject
DEFINE uploadResult INTEGER
CALL ui.Application.GetCurrent().SetClassNames(["full-upload-info"])
LET filenames = fgl_file_dialog("open",1,"Select image",null,NULL,"image/*")
IF filenames IS NOT NULL THEN
LET ja = util.JsonArray.parse(filenames)
FOR i = 1 TO ja.getSize()
LET jo = ja.get(i)
LET uploadResult = fgl_upload(i, jo.get('name'))
IF uploadResult = 0 THEN
DISPLAY "Error uploading file: ", jo.get('name')
ELSE
DISPLAY "FILE UPLOADED ", i, ": ", jo.get('name'), " - ", jo.get('size'), " - ", jo.get('type'), " - ", jo.get('lastModified')
END IF
END FOR
END IF
END MAIN