Skip to contents

Uploads path to the active base and returns the SeaTable file object (a named list with name, size, type and url) ready to be written into a file-typed cell via hb_update_rows() or hb_attach_file().

Usage

hb_upload_file(client, path, ..., relative_path = "files")

Arguments

client

A harbour_client.

path

Local file path. Must exist.

...

These dots are for future extensions and must be empty.

relative_path

Folder under the base's asset root. The default, "files", stands for the folder the upload link names: files/<YYYY-MM> for the current month, or images/<YYYY-MM> when path has an image extension (.png, .jpg, .jpeg, .gif, .bmp, .webp or .svg). Passing "files" yourself does the same. Any other value is used as given, but may not climb out of the asset root with ...

Value

A named list describing the uploaded asset.

Details

SeaTable's file endpoints authenticate with the base's API token, so this needs a client created with api_token; a username/password client gets a harbour_error_auth condition.

A finite client timeout bounds the complete upload request. A timeout can occur after the server has accepted the file; it does not establish that the upload was rolled back. Check the server before retrying to avoid creating a duplicate attachment. Uploads are not retried automatically.

Examples

# needs a SeaTable server and an API token
if (FALSE) { # \dontrun{
client <- hb_client()
hb_upload_file(client, "report.pdf")
} # }