TijsVerkoyen\Dropbox\Dropbox::fileopsMove PHP Метод

fileopsMove() публичный Метод

Moves a file or folder to a new location.
public fileopsMove ( string $fromPath, string $toPath, string[optional] $locale = null, bool[optional] $sandbox = false ) : array
$fromPath string Specifies the file or folder to be moved from relative to root.
$toPath string Specifies the destination path, including the new name for the file or folder, relative to root.
$locale string[optional]
$sandbox bool[optional]
Результат array
    public function fileopsMove($fromPath, $toPath, $locale = null, $sandbox = false)
    {
        // build url
        $url = '1/fileops/move';
        // build parameters
        $parameters['from_path'] = (string) $fromPath;
        $parameters['to_path'] = (string) $toPath;
        $parameters['root'] = $sandbox ? 'sandbox' : 'dropbox';
        if ($locale !== null) {
            $parameters['locale'] = (string) $locale;
        }
        // make the call
        return $this->doCall($url, $parameters, 'POST');
    }

Usage Example

Пример #1
0
 /**
  * Tests Dropbox->fileopsMove()
  */
 public function testFileopsMove()
 {
     $this->dropbox->fileopsCreateFolder(BASE_PATH . 'will_be_moved');
     $response = $this->dropbox->fileopsMove(BASE_PATH . 'will_be_moved', BASE_PATH . 'moved');
     $this->isDir($response);
     $this->dropbox->fileopsDelete(BASE_PATH . 'moved');
 }