示例#1
0
/**
 * Возвращает максимальный размер для загружаемых файлов
 *
 * @param $bytes boolean Если да, то вернет в байтах
 * @return void
 */
function get_max_filesize($bytes = false)
{
    $sizes = array(str_to_bytes(ini_get('memory_limit')), str_to_bytes(ini_get('post_max_size')), str_to_bytes(ini_get('upload_max_filesize')));
    $maxfile = min($sizes);
    if (!$bytes) {
        $ret = bytes_to_str($maxfile);
    } else {
        $ret = $maxfile;
    }
    return $ret;
}
示例#2
0
 <tr>
  <th>Имя файла</th>
  <th style="width:150px">Размер</th>
  <th style="width:150px">Последнее изменение</th>
  <th style="width:150px">Состояние</th>
 </tr>
<?php 
foreach ($files as $file) {
    ?>
 <tr>
  <td><?php 
    echo $file['file'];
    ?>
</td>
  <td><?php 
    echo bytes_to_str($file['size']);
    ?>
</td>
  <td><?php 
    echo date('d.m.Y H:i', $file['date']);
    ?>
</td>
  <td><?php 
    echo $file['status'];
    ?>
</td>
 </tr>
<?php 
}
?>
</table>
示例#3
0
 private function GetFileDetails($file, $file_name)
 {
     //Тип
     $exte = explode('.', $file_name);
     $ext = strtolower(end($exte));
     //Имя
     $name = implode('.', array_slice($exte, 0, -1));
     //Размер
     $size = filesize($file);
     $sizeStr = bytes_to_str($size);
     //Информация по разным типам файлов
     $info = array();
     switch ($ext) {
         case 'flv':
         case 'mp3':
             $info = $this->get_video_size($file);
             break;
         default:
             if (!in_array($ext, $this->supported_exts)) {
                 break;
             }
             //Вроде и все ))
             break;
     }
     return array('type' => $ext, 'name' => $name, 'size' => $size, 'sizeStr' => $sizeStr, 'info' => $info);
 }