Uploads the specified files to a NocoDB server as attachments via its
POST /api/v2/storage/upload API endpoint. Uploaded files are stored under /nc/uploads/ in the configured
object storage bucket (if one is set up) or directly on the server's filesystem.
Usage
upload_attachments(
paths,
types = mime::guess_type(paths),
names = NULL,
upload_path = "r",
origin = funky::config_val("origin"),
email = funky::config_val("email"),
password = funky::config_val("password"),
api_token = funky::config_val("api_token"),
max_tries = 5L,
verbosity = NULL
)Arguments
- paths
character()
Paths to the files to be uploaded.- types
character()
Media type(s) of the uploaded files. A character vector of the same length aspaths.- names
character()
File names to assign to the uploaded files. A character vector of the same length aspathsorNULL. IfNULL, the original file names frompathsare used. Note that a random string like_NnW3Cis always appended to the resulting file name before its file type suffix, sonames = "some-pic.jpg"will result in a file name likesome-pic_NnW3C.jpg, for example.- upload_path
character(1)
Destination path to store the uploaded file(s) at. Always interpreted relative to the directory/nc/uploads/(which is hardcoded in NocoDB's source code). Note that the characters.and?are replaced with_by the API.- origin
character(1)
NocoDB server origin.character(1)
E-mail address of the NocoDB user to authenticate with.- password
character(1)
Password of the NocoDB user to authenticate with.- api_token
character(1)
NocoDB API token. Takes precedence overemailandpasswordif provided.- max_tries
integer(1)
Maximum number of request attempts in case of an HTTP error. An integerish scalar. Retries are performed using exponential backoff and jitter, seehttr2::req_retry()for details.- verbosity
How much information to print? This is a wrapper around
req_verbose()that uses an integer to control verbosity:0: no output1: show headers2: show headers and bodies3: show headers, bodies, and curl status messages.
Use
with_verbosity()to control the verbosity of requests that you can't affect directly.
Value
A tibble containing metadata about the uploaded attachments.