本文整理汇总了PHP中manager::getFileType方法的典型用法代码示例。如果您正苦于以下问题:PHP manager::getFileType方法的具体用法?PHP manager::getFileType怎么用?PHP manager::getFileType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类manager
的用法示例。
在下文中一共展示了manager::getFileType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
}elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE))
{
$error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE));
}else
{
include_once(CLASS_FILE);
$path = $upload->getFilePath();
$obj = new file($path);
$tem = $obj->getFileInfo();
if(sizeof($tem))
{
include_once(CLASS_MANAGER);
$manager = new manager($upload->getFilePath(), false);
$fileType = $manager->getFileType($upload->getFileName());
foreach($fileType as $k=>$v)
{
$tem[$k] = $v;
}
$tem['path'] = backslashToSlash($path);
$tem['type'] = "file";
$tem['size'] = transformFileSize($tem['size']);
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
$tem['short_name'] = shortenFileName($tem['name']);
$tem['flag'] = 'noFlag';
$obj->close();
foreach($tem as $k=>$v)
示例2: manager
<?php
/* For licensing terms, see /license.txt */
/**
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/April/2007
*
*/
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
if (!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path'])) {
include_once CLASS_MANAGER;
$manager = new manager($_GET['path'], false);
$fileTypes = $manager->getFileType(basename($_GET['path']));
if ($fileTypes['preview']) {
switch ($fileTypes['fileType']) {
case "image":
$imageInfo = @getimagesize($_GET['path']);
if (!empty($imageInfo[0]) && !empty($imageInfo[1])) {
$thumInfo = getThumbWidthHeight($imageInfo[0], $imageInfo[1], 400, 135);
printf("<img src=\"%s\" width=\"%s\" height=\"%s\" />", getFileUrl($_GET['path']), $thumInfo['width'], $thumInfo['height']);
} else {
echo PREVIEW_IMAGE_LOAD_FAILED;
}
break;
case "txt":
if ($fp = @fopen($_GET['path'], 'r')) {
echo @fread($fp, @filesize($_GET['path']));
@fclose($fp);
} else {
示例3: doSearch
/**
* get the file according to the search keywords
*
*/
function doSearch($baseFolderPath = null)
{
$baseFolderPath = addTrailingSlash(backslashToSlash((is_null($baseFolderPath)?$this->rootFolder:$baseFolderPath)));
$dirHandler = @opendir($baseFolderPath);
if($dirHandler)
{
while(false !== ($file = readdir($dirHandler)))
{
if($file != '.' && $file != '..')
{
$path = $baseFolderPath . $file;
if(is_file($path))
{
$isValid = true;
$fileTime = @filemtime($path);
$fileSize = @filesize($path);
if($this->searchkeywords['name'] !== '' && @eregi($this->searchkeywords['name'], $file) === false)
{
$isValid = false;
}
if($this->searchkeywords['mtime_from'] != '' && $fileTime < @strtotime($this->searchkeywords['mtime_from']))
{
$isValid = false;
}
if($this->searchkeywords['mtime_to'] != '' && $fileTime > @strtotime($this->searchkeywords['mtime_to']))
{
$isValid = false;
}
if($this->searchkeywords['size_from'] != '' && $fileSize < @strtotime($this->searchkeywords['size_from']))
{
$isValid = false;
}
if($this->searchkeywords['size_to'] != '' && $fileSize > @strtotime($this->searchkeywords['size_to']))
{
$isValid = false;
}
if($isValid && isListingDocument($path))
{
$finalPath = $path;
$objFile = new file($finalPath);
$tem = $objFile->getFileInfo();
$obj = new manager($finalPath, false);
$obj->setSessionAction($this->sessionAction);
$selectedDocuments = $this->sessionAction->get();
$fileType = $obj->getFileType($finalPath);
foreach($fileType as $k=>$v)
{
$tem[$k] = $v;
}
$tem['path'] = backslashToSlash($finalPath);
$tem['type'] = (is_dir($finalPath)?'folder':'file');
/* $tem['size'] = transformFileSize($tem['size']);
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);*/
$tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag');
$tem['url'] = getFileUrl($tem['path']);
$this->rootFolderInfo['file']++;
$manager = null;
$this->files[] = $tem;
$tem = null;
}
}elseif(is_dir($path) && $this->searchkeywords['recursive'])
{
$this->Search($baseFolderPath);
}
}
}
}
}
示例4: file
}
include_once CLASS_FILE;
$file = new file();
//check if all files are allowed to cut or copy
foreach ($selectedDocuments as $doc) {
if (file_exists($doc) && isUnderRoot($doc)) {
if (array_search(getRealPath($doc), $allDocs) === false || CONFIG_OVERWRITTEN) {
if (CONFIG_OVERWRITTEN) {
$file->delete($doc);
}
if ($file->copyTo($doc, $_GET['current_folder_path'])) {
$finalPath = $destFolderPath . basename($doc);
$objFile = new file($finalPath);
$tem = $objFile->getFileInfo();
$obj = new manager($finalPath, false);
$fileType = $obj->getFileType($finalPath, is_dir($finalPath) ? true : false);
foreach ($fileType as $k => $v) {
$tem[$k] = $v;
}
/* foreach ($folderInfo as $k=>$v)
{
$tem['i_' . $k] = $v;
}
if($folderInfo['type'] == 'folder' && empty($folderInfo['subdir']) && empty($folderInfo['file']))
{
$tem['cssClass'] = 'folderEmpty';
}*/
$tem['final_path'] = $finalPath;
$tem['path'] = backslashToSlash($finalPath);
$tem['type'] = is_dir($finalPath) ? 'folder' : 'file';
$tem['size'] = @transformFileSize($tem['size']);
示例5: basename
if( array_search(getRealPath($doc), $allDocs) === false || CONFIG_OVERWRITTEN)
{
if(CONFIG_OVERWRITTEN)
{
$file->delete($doc);
}
if($file->copyTo($doc, $_GET['current_folder_path']))
{
$finalPath = $destFolderPath . basename($doc);
$objFile = new file($finalPath);
$tem = $objFile->getFileInfo();
$obj = new manager($finalPath, false);
$fileType = $obj->getFileType($finalPath);
foreach($fileType as $k=>$v)
{
$tem[$k] = $v;
}
$tem['path'] = backslashToSlash($doc);
$tem['type'] = (is_dir($finalPath)?'folder':'file');
$tem['size'] = @transformFileSize($tem['size']);
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
$tem['flag'] = 'noFlag';
$tem['url'] = getFileUrl($doc);
$manager = null;