Skip to contents

Deletes a file uploaded to a specific field in a REDCap project for a given record. Supports deleting files from repeating instances and events if specified.

Usage

delete_file_from_REDCap(
  DB,
  record,
  field,
  repeat_instance = NULL,
  event = NULL
)

Arguments

DB

A validated `DB` object containing REDCap project data and settings. Generated using load_DB or setup_DB

record

Character. The unique identifier of the record from which the file should be deleted.

field

Character. The name of the field in REDCap where the file is stored.

repeat_instance

Optional. Numeric. The repeating instance of the record (if applicable) from which the file should be deleted.

event

Optional. Character. The unique event name (if applicable) from which the file should be deleted.

Value

A message indicating whether the file was successfully deleted.

Details

This function sends a request to the REDCap API to delete a file associated with a specific record and field. It supports optional parameters to handle repeating instruments or events, ensuring flexibility for more complex REDCap projects. If the API request fails, the function raises an error.

See also

save_DB for managing database objects.