Four Js Development Tools Forum

Discussions by product => GAS and GBC => Topic started by: Paul M. on May 11, 2022, 11:30:37 pm



Title: FileUpload style deprecated
Post by: Paul M. on May 11, 2022, 11:30:37 pm
Just upgraded our Dev servers to GAS 3.20.15 and the GBC is complaining the "Style=FileUpload has been deprecated Use fgl_getfile().  We use fgl_getfile after we get the windows file location using the input from the edit box.

I am wondering if there is a work around for this process or whether my thinking is still in version 2.X.   



Title: Re: FileUpload style deprecated
Post by: Gary C. on May 12, 2022, 02:56:00 pm
There's no workaround that I am aware of.

We use a button edit in the form:

Code
  1. buttonedit f002 = formonly.file_src,required,not null,image="DownloadFolder",action=uploadfile;

and the corresponding action will be along the lines of, with some error handling of course:

Code
  1.        on action uploadfile
  2.            call ui.Interface.frontCall("standard", "openfile", ["", %"Excel Files", "*.xlsx", %"Upload File"], file_src)
  3.            if file_src is not null then
  4.                call fgl_getfile(file_src, file_dst)
  5.            end if


Title: Re: FileUpload style deprecated
Post by: Reuben B. on May 16, 2022, 10:47:39 am
There is a page in the 3.0X GAS docs that explain this.   That page does not appear in 3.1X or later docs and it probably should, I have asked for it to be reinstated.

Gary has it right.  There needs to be an openFile front-call followed by FGL_GETFILE.  This is the cross platform solution for all front-ends, rather than having IF gdc do this ELSE IF Web do something different.

Essentially in a browser environment, you cannot have a standalone FGL_GETFILE(source filename, destination filename) where the source filename variable is coded by the developer without any user input.  For instance the equivalent of FGL_GETFILE("/etc/hosts",...), FGL_GETFILE("C:/<guess>/password.txt",...) etc, browsers simply do not allow to happen .  You have to force the user to choose a file via the openFile frontcall.  FGL_GETFILE then puts the chosen file in the desired destination.

Reuben