uploaddatatoserver
UPLOADOPTIONS
,
REPLY

The uploaddatatoserver statement uploads binary data to the server.


Parameters

This statement has two parameters:

uploadoptions – dictionary of additional options and data, see below.

reply – dictionary with information about finished upload, see below.


Description

This statement uploads binary data to the server (synchronously). The data is specified in a formula, and should be in binary format. If the data is over 12k in size, it will compressed using .zip compression. If the data is over 30k in size a progress bar will be shown in the toolbar. Note: This statement only works when used with a database that is already shared, i.e. already connected to a server.

There is only one required option, the data to be uploaded. This is passed in the “DATA” key in the options dictionary, as shown in this example.

local xreply,uploadFile
choosefile uploadFile
if uploadFile="" return endif
uploaddatatoserver initializedictionary(
    "DATA",fileload(uploadFile)
),xreply
let uploadID = getdictionaryvalue(xreply,"DATAIDENTIFIER")

As shown in the example above, this statement returns a dictionary with information about the success or failure of the upload. If the upload succeeds, the “DATAIDENTIFIER” key will contain the id code for the uploaded data. The data is temporarily stored in a file on the server until you run some server code to access it. For example you could run web code to access the procedure. You will need to pass the uploadID to this code, either as part of the URL, or as part of a POST argument. This code fragment loads the uploaded binary data into a local variable. It then deletes the file containing the temporarily uploaded data – so you can only run the getuploadeddata( function once per uploaded item.

let myUploadedData = getuploadeddata(uploadID)

Once you have the data in hand you can do whatever you want with it – save it to a file, store it in a database, anything you want. Internally Panorama X uses this uploaddatatoserver statement for formulafill, import, and database append into a shared multi-user database.


See Also


History

VersionStatusNotes
10.2NewNew in this version.