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",
hostname = pal::pkg_config_val("hostname"),
email = pal::pkg_config_val("email"),
password = pal::pkg_config_val("password"),
api_token = pal::pkg_config_val("api_token"),
max_tries = 5L,
verbosity = NULL
)
Arguments
- paths
Paths to the files to be uploaded. A character vector.
- types
Media type(s) of the uploaded files. A character vector of the same length as
paths
.- names
File names to assign to the uploaded files. A character vector of the same length as
paths
orNULL
. IfNULL
, the original file names frompaths
are used. Note that a random string like_NnW3C
is 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
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). A character scalar. Note that the characters.
and?
are replaced with_
by the API.- hostname
NocoDB server hostname. A character scalar.
E-mail address of the NocoDB user to authenticate with.
- password
Password of the NocoDB user to authenticate with.
- api_token
NocoDB API token. Takes precedence over
email
andpassword
if provided.- max_tries
Maximum number of attempts to retry in case of an HTTP error. An integerish scalar.
- 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.