本文整理汇总了PHP中LocalFile::copyTo方法的典型用法代码示例。如果您正苦于以下问题:PHP LocalFile::copyTo方法的具体用法?PHP LocalFile::copyTo怎么用?PHP LocalFile::copyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalFile
的用法示例。
在下文中一共展示了LocalFile::copyTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyFile
//.........这里部分代码省略.........
$nameForCheck = implode(' ', $futureName);
if ($extension) {
$nameForCheck .= '.' . $extension;
}
$number++;
$newFile = FSI::getFile($params['dest'] . "/" . $nameForCheck);
$params['filenameChange'] = $nameForCheck;
if (!array_key_exists('parent', $params['file'])) {
$params['pathChange'] = substr($params['orig'], strlen($pathCloud . $cloudOrig));
}
}
$filename = $newFile->getName();
} else {
$filename = $params['file']['filename'];
}
if ($cloudspace) {
$pathParent = substr($params['dest'], strlen($pathCloud . $cloudDestination));
if (array_key_exists('parent', $params['file'])) {
if (strlen($pathParent) == 0 && !$params['file']['parent']) {
$pathParent = '/';
}
if ($params['file']['parent']) {
$pathParent .= $params['file']['parent'];
}
} else {
$pathParent .= '/' . substr($params['file']['path'], strlen($pathOrig));
if (strlen($pathParent) > 1) {
$pathParent = substr($pathParent, 0, -1);
}
}
$folder = NULL;
if ($pathParent !== '/') {
$pos = strrpos($pathParent, '/');
$folder = substr($pathParent, $pos + 1);
$pathParent = substr($pathParent, 0, $pos + 1);
}
$parentId = false;
if ($folder) {
$path = $pathParent . $folder . '/';
$lista = new stdClass();
$lista->cloud = $cloudDestination;
$lista->path = $pathParent;
$lista->filename = $folder;
$lista->user_eyeos = $user->getId();
$u1db = json_decode($apiManager->callProcessU1db('parent', $lista));
if ($u1db !== NULL && count($u1db) > 0) {
$parentId = $u1db[0]->id;
if ($parentId === 'null') {
$parentId = '0';
}
}
} else {
$parentId = '0';
$path = $pathParent;
}
if ($parentId !== false) {
$token = $_SESSION['access_token_' . $cloudDestination . '_v2'];
$resourceUrl = null;
if (isset($params['resource_url'])) {
$token = new stdClass();
$token->key = $params['access_token_key'];
$token->secret = $params['access_token_secret'];
$resourceUrl = $params['resource_url'];
}
$metadata = $apiManager->createMetadata($cloudDestination, $token, $user->getId(), !$isFolder, $filename, $parentId, $path, $pathAbsolute, $resourceUrl);
if ($metadata['status'] == 'KO') {
if ($metadata['error'] == 403) {
$denied = self::permissionDeniedCloud($cloudDestination);
$metadata['path'] = $denied['path'];
}
return $metadata;
}
}
}
$pathDest = null;
if (array_key_exists('parent', $params['file'])) {
if ($params['file']['parent']) {
$pathDest = $params['dest'] . $params['file']['parent'] . '/';
} else {
$pathDest = $params['dest'] . '/';
}
} else {
if ($pathOrig == $params['file']['path']) {
$pathDest = $params['dest'] . '/';
} else {
$pathDest = $params['dest'] . '/' . substr($params['file']['path'], strlen($pathOrig));
}
}
$pathDest .= $filename;
$newFile = FSI::getFile($pathDest);
if ($isFolder) {
$newFile->mkdir();
} else {
$tmpFile->copyTo($newFile);
}
if ($tmpFile) {
$tmpFile->delete();
}
return $params;
}