本文整理汇总了PHP中CUtil::unformat方法的典型用法代码示例。如果您正苦于以下问题:PHP CUtil::unformat方法的具体用法?PHP CUtil::unformat怎么用?PHP CUtil::unformat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtil
的用法示例。
在下文中一共展示了CUtil::unformat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processActionUpload
public function processActionUpload(array $params)
{
$storage = $this->getStorageObject();
if ($this->getDesktopDiskVersion() > 0) {
$this->checkRequiredParams($params, array('name'));
$filename = $params['name'];
}
if ($storage::compareVersion($_SERVER['CONTENT_LENGTH'], (string) min(CUtil::unformat(ini_get('upload_max_filesize')), CUtil::unformat(ini_get('post_max_size')))) > 0) {
return $this->sendResponse(array('status' => static::STATUS_TOO_BIG));
}
if (empty($_FILES['file']) || !is_array($_FILES['file'])) {
throw new Exception('Please load file!');
}
list($startRange, $endRange, $fileSize) = $this->getContentRange();
if ($startRange !== null) {
if ($endRange - $startRange + 1 != $_FILES['file']['size']) {
return $this->sendResponse(array('status' => static::STATUS_CHUNK_ERROR, 'message' => 'Size of file: ' . $_FILES['file']['size'] . ' not equals size of chunk: ' . ($endRange - $startRange + 1) . ''));
}
if ($startRange == 0) {
//attempt to decide: cloud? not cloud?
$bucket = $this->findBucketForFile(array('name' => $filename, 'fileSize' => $fileSize));
if ($bucket !== false) {
$tmpFile = CWebDavTmpFile::buildFromDownloaded($_FILES['file']);
list($tmpFile->width, $tmpFile->height) = CFile::getImageSize($tmpFile->getAbsolutePath());
$newFile = clone $tmpFile;
$newFile->filename = $filename;
$newFile->isCloud = true;
$newFile->bucketId = $bucket->ID;
$newFile->append($tmpFile, compact('startRange', 'endRange', 'fileSize'));
if (!$newFile->save()) {
throw new Exception('Error in DB');
}
} else {
//simple upload
$newFile = $this->createNewFile();
}
return $this->sendSuccess(array('token' => $newFile->name));
} else {
//if run resumable upload we needed token.
$this->checkRequiredParams($params, array('token'));
if (!($tmpResumableFile = CWebDavTmpFile::buildByName($params['token']))) {
return $this->sendResponse(array('status' => static::STATUS_CHUNK_ERROR, 'message' => 'Not found file by token'));
}
$success = $tmpResumableFile->append(CWebDavTmpFile::buildFromDownloaded($_FILES['file']), compact('startRange', 'endRange', 'fileSize'));
if ($success) {
return $this->sendSuccess(array('token' => $tmpResumableFile->name));
}
}
} else {
//simple upload
$newFile = $this->createNewFile();
return $this->sendSuccess(array('token' => $newFile->name));
}
}