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


PHP manager::getFileType方法代码示例

本文整理汇总了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)
开发者ID:hungnv0789,项目名称:vhtm,代码行数:31,代码来源:ajax_file_upload.php

示例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 {
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:ajax_preview.php

示例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);
						}
					}
				}
			}
			 
		}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:79,代码来源:class.search.php

示例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']);
开发者ID:oanav,项目名称:closetshare,代码行数:31,代码来源:ajax_file_paste.php

示例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;
开发者ID:Ting-Article,项目名称:Interview,代码行数:30,代码来源:ajax_file_paste.php


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