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


PHP CKFinder_Connector_Utils_FileSystem::readfileChunked方法代码示例

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


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

示例1: sendResponse

 /**
  * send response (file)
  * @access public
  *
  */
 function sendResponse()
 {
     if (!function_exists('ob_list_handlers') || !ob_list_handlers()) {
         @ob_end_clean();
     }
     header("Content-Encoding: none");
     $this->checkConnector();
     $this->checkRequest();
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["FileName"]);
     $_resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if (!$_resourceTypeInfo->checkExtension($fileName, false)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
     if ($_resourceTypeInfo->checkIsHiddenFile($fileName) || !file_exists($filePath) || !is_file($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($fileName);
     header("Cache-Control: cache, must-revalidate");
     header("Pragma: public");
     header("Expires: 0");
     header("Content-type: application/octet-stream; name=\"" . $fileName . "\"");
     header("Content-Disposition: attachment; filename=\"" . str_replace("\"", "\\\"", $fileName) . "\"");
     header("Content-Length: " . filesize($filePath));
     CKFinder_Connector_Utils_FileSystem::readfileChunked($filePath);
     exit;
 }
开发者ID:BGCX067,项目名称:facebooksurveyom-svn-to-git,代码行数:38,代码来源:DownloadFile.php

示例2: sendResponse

 /**
  * send response (file)
  * @access public
  *
  */
 public function sendResponse()
 {
     if (!function_exists('ob_list_handlers') || ob_list_handlers()) {
         @ob_end_clean();
     }
     header("Content-Encoding: none");
     $this->checkConnector();
     $this->checkRequest();
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["FileName"]);
     $_resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if (!$_resourceTypeInfo->checkExtension($fileName, false)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
     if ($_resourceTypeInfo->checkIsHiddenFile($fileName) || !file_exists($filePath) || !is_file($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($fileName);
     header("Cache-Control: cache, must-revalidate");
     header("Pragma: public");
     header("Expires: 0");
     if (!empty($_GET['format']) && $_GET['format'] == 'text') {
         header("Content-Type: text/plain; charset=utf-8");
     } else {
         $user_agent = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
         $encodedName = str_replace("\"", "\\\"", $fileName);
         if (strpos($user_agent, "MSIE") !== false) {
             $encodedName = str_replace(array("+", "%2E"), array(" ", "."), urlencode($encodedName));
         }
         header("Content-type: application/octet-stream; name=\"" . $fileName . "\"");
         header("Content-Disposition: attachment; filename=\"" . $encodedName . "\"");
     }
     header("Content-Length: " . filesize($filePath));
     CKFinder_Connector_Utils_FileSystem::readfileChunked($filePath);
     exit;
 }
开发者ID:knieper,项目名称:crltmich,代码行数:47,代码来源:DownloadFile.php

示例3: sendWithXSendfile

 /**
  * Send files using X-Sendfile server module
  *
  * @param string $filePath
  */
 public static function sendWithXSendfile($filePath)
 {
     if (stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== FALSE) {
         $fallback = true;
         $config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
         $XSendfileNginx = $config->getXSendfileNginx();
         foreach ($XSendfileNginx as $location => $root) {
             if (false !== stripos($filePath, $root)) {
                 $fallback = false;
                 $filePath = str_ireplace($root, $location, $filePath);
                 header("X-Accel-Redirect: " . $filePath);
                 // Nginx
                 break;
             }
         }
         // fallback to standar method
         if ($fallback) {
             CKFinder_Connector_Utils_FileSystem::readfileChunked($filePath);
         }
     } elseif (stripos($_SERVER['SERVER_SOFTWARE'], 'lighttpd/1.4') !== FALSE) {
         header("X-LIGHTTPD-send-file: " . $filePath);
         // Lighttpd v1.4
     } else {
         header("X-Sendfile: " . $filePath);
         // Apache, Lighttpd v1.5, Cherokee
     }
 }
开发者ID:itmyprofession,项目名称:admin,代码行数:32,代码来源:FileSystem.php


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