View source: R/attach_file_to_resource.R
Attach a file to an existing resource
1 2 3 4 5 6 7 | attach_file_to_resource(
resource_nid,
file_path,
root_url = dkanr::get_url(),
credentials = list(cookie = dkanr::get_cookie(), token = dkanr::get_token()),
attach = 1
)
|
resource_nid |
character: Data Catalog Resource Node ID |
file_path |
character: Path to file on local machine |
root_url |
character: API root URL |
credentials |
Optional list parameter. Default values are Cookie and Token generated by dkan_setup() |
attach |
numeric: Setting the attach parameter to 0 ensures that the file will replace any existing file on the resource. Setting it to 1 will result in a rejected request if the resource already has an attached file (but it will work if the resource file upload field is empty). |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.