copy_file | R Documentation |
When a file (image) is uploaded through a fileInput widget, it is saved to a temporary folder. This function copies that file to an appropriate directory and name. The file does not have to be originally in a temporary folder, any file path is ok. Therefore this function can also be used e.g. when cloning and event and the images associated with it need to be duplicated.
copy_file( orig_filepath, variable_name, site, block, date, filepath_is_relative = FALSE, delete_original = FALSE, base_folder = json_file_base_folder() )
orig_filepath |
The path of the file to copy |
variable_name |
Which variable is this file for? E.g. canopeo_image |
site |
The site where the event took place |
block |
The block where the event took place |
date |
The day of the event as a character string, the format must be yyyy-mm-dd |
filepath_is_relative |
If TRUE, json_file_base_folder will be added to the beginning of filepath |
delete_original |
Should the original file be deleted after copying? |
base_folder |
Included for testing reasons, the default value should otherwise be used |
The name will be of the format yyyy-mm-dd_site_block_variable_name_# where # is a number (0, 1, 2, ...) to ensure that files have unique names.
A path to the new location of the file relative to the events.json file.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.