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


PHP Converter::convertShortSizeToHumanReadable方法代码示例

本文整理汇总了PHP中XLite\Core\Converter::convertShortSizeToHumanReadable方法的典型用法代码示例。如果您正苦于以下问题:PHP Converter::convertShortSizeToHumanReadable方法的具体用法?PHP Converter::convertShortSizeToHumanReadable怎么用?PHP Converter::convertShortSizeToHumanReadable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XLite\Core\Converter的用法示例。


在下文中一共展示了Converter::convertShortSizeToHumanReadable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doActionSelectUploadLanguageFile

 /**
  * "Upload" handler for category images.
  *
  * @return void
  */
 protected function doActionSelectUploadLanguageFile()
 {
     $result = null;
     $error = null;
     $message = null;
     $key = 'uploaded_file';
     $cell = isset($_FILES[$key]) ? $_FILES[$key] : null;
     if ($cell) {
         $size = null;
         switch ($cell['error']) {
             case UPLOAD_ERR_OK:
                 $path = \Includes\Utils\FileManager::getUniquePath(LC_DIR_TMP, $cell['name']);
                 if (move_uploaded_file($cell['tmp_name'], $path)) {
                     $result = $path;
                 }
                 break;
             case UPLOAD_ERR_INI_SIZE:
                 $size = ini_get('upload_max_filesize');
             case UPLOAD_ERR_FORM_SIZE:
                 $size = $size ?: \XLite\Core\Request::getInstance()->MAX_FILE_SIZE;
                 $error = 'File size exceeds the maximum size (' . $size . ')';
                 $size = \XLite\Core\Converter::convertShortSizeToHumanReadable($size);
                 $message = \XLite\Core\Translation::lbl('File size exceeds the maximum size', array('size' => $size));
                 break;
             case UPLOAD_ERR_PARTIAL:
                 $error = 'The uploaded file was only partially uploaded';
             case UPLOAD_ERR_NO_FILE:
                 $error = $error ?: 'No file was uploaded';
             case UPLOAD_ERR_NO_TMP_DIR:
                 $error = $error ?: 'Missing a temporary folder';
             case UPLOAD_ERR_CANT_WRITE:
                 $error = $error ?: 'Failed to write file to disk';
             case UPLOAD_ERR_EXTENSION:
                 $message = \XLite\Core\Translation::lbl('The file was not loaded because of a failure on the server.');
                 $error = $error ?: 'File upload stopped by extension';
                 break;
             default:
         }
     }
     if ($result && $message) {
         \XLite\Logger::getInstance()->log('Upload file error: ' . $error ?: $message, LOG_ERR);
     }
     $this->doActionSelectLanguageFile($result, $message);
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:49,代码来源:SelectFileAbstract.php

示例2: getUploadFileMessage

 /**
  * Defines the message for uploading files
  * 
  * @return string
  */
 protected function getUploadFileMessage()
 {
     $filesize = \XLite\Core\Converter::getUploadFileMaxSize();
     return static::t('The maximum file size that can be uploaded: X', array('upload_max_filesize' => \XLite\Core\Converter::convertShortSizeToHumanReadable($filesize)));
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:10,代码来源:FileSelectorDialog.php


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