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.
Usage
copy_file(
orig_filepath,
variable_name,
site,
block,
date,
filepath_is_relative = FALSE,
delete_original = FALSE,
base_folder = json_file_base_folder()
)
Arguments
- 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