Uploadcare\Api::copyFile PHP Method

copyFile() public method

Copy file
public copyFile ( string $source, string $target = null ) : File | string
$source string CDN URL or file's uuid you need to copy.
$target string Name of custom storage connected to your project. Uploadcare storage is used if target is absent.
return File | string
    public function copyFile($source, $target = null)
    {
        $data = $this->__preparedRequest('file_copy', 'POST', array(), array('source' => $source, 'target' => $target));
        if (array_key_exists('result', (array) $data) == true) {
            if ($data->type == 'file') {
                return new File((string) $data->result->uuid, $this);
            } else {
                return (string) $data->result;
            }
        } else {
            return (string) $data->detail;
        }
    }