Question
Is it possible in Totum to save a file located at an external link into a field when a button is pressed?
Answer
To save a file, we need a field of type File. We will place the file into it via set using a Button.
Button action code:
=: set(table: $#ntn; field: 'h_file' = $filesData)
filesData: listCreate(item: $rowFile)
rowFile: rowCreate(field: "name" = "Uploaded_file.png"; field: "filestring" = $get)
get: getFromScript(uri: "https://totum.totum.online/fls/365_392_file.png")
In the File field, there is always a list, so we perform listCreate from a row
, which has two keys ā name
and filestring
. In filestring
, we pass what getFromScript received from the provided link.
Here is an example with a header. If setting in the row part, don't forget the where
parameter to determine the row.