Uploads a file to REDCap for a specified record ID and field name.
Source:R/processing.R
upload_file_to_redcap.RdUploads a file to REDCap for a specified record ID and field name.
Arguments
- filepath
Path to the file to be uploaded.
- record_id
String containing the unique identifier for the record in REDCap.
- fieldname
Field name to which the file will be uploaded.
- api_url
String, URL to the REDCap API, should be specified in your personal config.R file
- api_token
String, personal token for the REDCap API, should be specified in your personal config.R file
Examples
if (FALSE) { # file.exists(path.expand("~/.config.R"))
source(path.expand("~/.config.R"))
tmp <- tempfile(fileext = ".txt")
writeLines(c("Example content"), tmp)
upload_file_to_redcap(
filepath = tmp, record_id = "1", fieldname = "wric_data",
api_url = api_url, api_token = api_token
)
}