This function uploads a file to a specific record and field in a REDCap project. It allows you to specify optional parameters like repeat instance and event to upload the file to a particular instance or event within a record.
Arguments
- DB
A validated `DB` object containing REDCap project data and settings. Generated using load_DB or setup_DB
- file
A character string specifying the file path of the file to be uploaded.
- record
A character string specifying the record ID to which the file will be uploaded.
- field
A character string specifying the field name to which the file will be associated.
- repeat_instance
Optional. A numeric or character string specifying the repeat instance of the record. Defaults to NULL.
- event
Optional. A character string specifying the event name to which the file will be uploaded. Defaults to NULL.
Details
This function uploads a specified file to a particular record and field in a REDCap project using the REDCap API. The file is uploaded as multipart data, and the function will automatically handle file existence checks. If provided, the `event` and `repeat_instance` parameters will be used to specify the precise location for the upload.