当前位置: 首页>>代码示例>>PHP>>正文


PHP CUtil::unformat方法代码示例

本文整理汇总了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));
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:54,代码来源:diskdispatcher.php


注:本文中的CUtil::unformat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。