public fileopsCopy ( string[optional] $fromPath = null, string $toPath, string[optional] $fromCopyRef = null, string[optional] $locale = null, bool[optional] $sandbox = false ) : array | ||
$fromPath | string[optional] | |
$toPath | string | Specifies the destination path, including the new name for the file or folder, relative to root. |
$fromCopyRef | string[optional] | |
$locale | string[optional] | |
$sandbox | bool[optional] | |
Результат | array |
public function fileopsCopy($fromPath = null, $toPath, $fromCopyRef = null, $locale = null, $sandbox = false)
{
// build url
$url = '1/fileops/copy';
// build parameters
$parameters['root'] = $sandbox ? 'sandbox' : 'dropbox';
if ($fromPath !== null) {
$parameters['from_path'] = (string) $fromPath;
}
$parameters['to_path'] = (string) $toPath;
if ($fromCopyRef !== null) {
$parameters['from_copy_ref'] = (string) $fromCopyRef;
}
if ($locale !== null) {
$parameters['locale'] = (string) $locale;
}
// make the call
return $this->doCall($url, $parameters, 'POST');
}
/** * Tests Dropbox->fileopsCopy() */ public function testFileopsCopy() { $response = $this->dropbox->fileopsCopy(BASE_PATH . 'image.png', BASE_PATH . 'copy.png'); $this->isFile($response); $this->dropbox->fileopsDelete(BASE_PATH . 'copy.png'); }