本文整理汇总了PHP中FileManager::get_ext方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::get_ext方法的具体用法?PHP FileManager::get_ext怎么用?PHP FileManager::get_ext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::get_ext方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: info
public function info($filename = '')
{
$this->open($filename);
$i['width'] = $this->im->getImageWidth();
$i['height'] = $this->im->getImageHeight();
$i['type'] = FileManager::get_ext($filename);
return $i;
}
示例2: count
}
/*
Формируем данные о по станичной навигации
*/
$start = ($_REQUEST['page'] - 1) * Manager::$conf['general.elements'];
$total = count($list);
$pages = ceil($total / Manager::$conf['general.elements']);
$list = array_slice($list, $start, Manager::$conf['general.elements']);
/*
Формируем список файлов для ответа
*/
foreach ($list as $item) {
//создаем превьюшки
$src = FileManager::clear_path(FileManager::convertToFileSystem(Manager::$conf['filesystem.files_abs_path'] . DS . $_REQUEST['path'] . DS . $item['name']));
$dest = '';
//$thumb_path.$item['name'];
//$width = Manager::$conf['thumbnail.width'];
//$height = Manager::$conf['thumbnail.hieght'];
//if (!file_exists($dest)){
//создаем превью
// if (!ImageManager::instance()->thunbnail($src, $dest, $width, $height)){
//если не удалось то выводим превью что просмотр не доступен
// $dest = 'pages/'.Manager::$conf['general.template'].'/img/error_thumbnails.gif';
// };
//}
$src = str_ireplace(Manager::$conf['filesystem.files_abs_path'], Manager::$conf['filesystem.path'], FileManager::convertToGeniral($src));
$dest = FileManager::convertToGeniral(str_ireplace(Manager::$conf['filesystem.files_abs_path'], Manager::$conf['filesystem.files_path'], $dest));
$files[] = array('fileext' => FileManager::get_ext($item['name']), 'filename' => $item['name'], 'filepath' => FileManager::path_encode(str_replace(array($item['name'], DS), array($item['name'], '/'), $src)), 'thumbnail' => '');
}
count($files) == 0 ? $data = array() : ($data = array('paginator' => array('pagesTotal' => $pages, 'pageCurrent' => $_REQUEST['page']), 'files' => $files));
echo json_encode($data);
示例3: explode
case UPLOAD_ERR_NO_FILE:
$code = 3;
//файл не был загружен
break;
case UPLOAD_ERR_OK:
if (!preg_match(',[[:cntrl:]]|[/\\:\\*\\?\\"\\<\\>\\|],', $_FILES['file']['name'])) {
$tempFile = $_FILES['file']['tmp_name'];
$targetPath = FileManager::clear_path(Manager::$conf['filesystem.files_abs_path'] . $_REQUEST['folder']);
$targetFile = $targetPath . $_FILES['file']['name'];
$s = Manager::$conf['filesystem.allowed_extensions'];
if ($s) {
$fileTypes = explode('|', strtolower(Manager::$conf['filesystem.allowed_extensions']));
} else {
$fileTypes = null;
}
$ext = FileManager::get_ext($_FILES['file']['name']);
if (!$fileTypes or in_array(strtolower($ext), $fileTypes)) {
move_uploaded_file(FileManager::convertToFileSystem($tempFile), FileManager::convertToFileSystem($targetFile));
chmod(FileManager::convertToFileSystem($targetFile), Manager::$conf['filesystem.file_chmod']);
} else {
$code = 4;
//Запрешенное расширение файла
}
} else {
$code = 5;
}
break;
}
} else {
$code = 1;
}
示例4: defined
* @copyright Copyright (c) 2010, Cyber Applications.
* @link http://www.cyberapp.ru/
* @since Version 1.1
* @file /includes/tasks/download_file.php
*/
/*
Защита от прямой загрузки
*/
defined('ACCESS') or die;
$file = FileManager::clear_path(Manager::$conf['filesystem.files_abs_path'] . DS . $_REQUEST['file']);
if (file_exists(FileManager::convertToFileSystem($file))) {
Manager::$conf['stream.mimes']['use_gzip'] = false;
//заружаем файл
$data = file_get_contents(FileManager::convertToFileSystem($file));
//получаем расширение файла
$ext = strtolower(FileManager::get_ext($file));
// Устанавливаем mime поумолчанию если не можем найти тип этого фала
if (!isset(Manager::$conf['stream.mimes'][$ext])) {
$mime = 'application/octet-stream';
} else {
$mime = is_array(Manager::$conf['stream.mimes'][$ext]) ? Manager::$conf['stream.mimes'][$ext][0] : Manager::$conf['stream.mimes'][$ext];
}
// Генирируем заголовки сервера
if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
header('Content-Type: "' . $mime . '"');
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header("Content-Transfer-Encoding: binary");
header('Pragma: public');
header("Content-Length: " . strlen($data));
示例5: defined
<?php
/**
* Cyber Image Manager
*
*
* @package Cyber Image Manager
* @author Radik
* @copyright Copyright (c) 2010, Cyber Applications.
* @link http://www.cyberapp.ru/
* @since Version 1.1
* @file /includes/tasks/get_info.php
*/
/*
Защита от прямой загрузки
*/
defined('ACCESS') or die;
header('Content-type: text/json; charset=' . Manager::$conf['general.char_set']);
$filename = FileManager::convertToFileSystem(urldecode(str_ireplace(Manager::$conf['filesystem.path'], Manager::$conf['filesystem.files_path'], $_POST['filename'])));
$types = Manager::$conf['stream.mimes'];
$types = htmlspecialchars($types[strtolower(FileManager::get_ext($filename))]);
$info = array('size' => filesize($filename), 'type' => $types);
echo json_encode($info);
示例6: info
public function info($filename = '')
{
$i = getimagesize($filename);
return array('width' => $i[0], 'height' => $i[1], 'type' => FileManager::get_ext($filename));
}