本文整理汇总了PHP中get_mimes函数的典型用法代码示例。如果您正苦于以下问题:PHP get_mimes函数的具体用法?PHP get_mimes怎么用?PHP get_mimes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_mimes函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param array
* @return void
*/
public function __construct($props = array())
{
if (count($props) > 0) {
$this->initialize($props);
}
$this->mimes =& get_mimes();
log_message('debug', 'Upload Class Initialized');
}
开发者ID:nockout,项目名称:tshpro,代码行数:14,代码来源:MY_Upload.php
示例2: __construct
public function __construct($namespace = 'xueba', $dir = '/')
{
$this->_mimes =& get_mimes();
$this->_CI =& get_instance();
$this->_CI->load->config('upload_images');
$this->config = $this->_CI->config->item('wanpitu');
$this->namespace = $namespace;
$this->dir = '/';
}
开发者ID:lwl1989,项目名称:paintmore,代码行数:9,代码来源:Alibaba_image.php
示例3: getMime
public static function getMime($name)
{
$mimes =& get_mimes();
$exp = explode('.', $name);
$extension = end($exp);
if (isset($mimes[$extension])) {
$mime = is_array($mimes[$extension]) ? $mimes[$extension][0] : $mimes[$extension];
} else {
$mime = 'application/octet-stream';
}
return $mime;
}
开发者ID:ramadhanl,项目名称:sia,代码行数:12,代码来源:Image.php
示例4: force_download
/**
* Force Download
*
* Generates headers that force a download to happen
*
* @param string filename
* @param mixed the data to be downloaded
* @param bool whether to try and send the actual file MIME type
* @return void
*/
function force_download($filename = '', $data = '', $set_mime = FALSE)
{
if ($filename === '' or $data === '') {
return FALSE;
}
// Set the default MIME type to send
$mime = 'application/octet-stream';
$x = explode('.', $filename);
$extension = end($x);
if ($set_mime === TRUE) {
if (count($x) === 1 or $extension === '') {
/* If we're going to detect the MIME type,
* we'll need a file extension.
*/
return FALSE;
}
// Load the mime types
$mimes =& get_mimes();
// Only change the default MIME if we can find one
if (isset($mimes[$extension])) {
$mime = is_array($mimes[$extension]) ? $mimes[$extension][0] : $mimes[$extension];
}
}
/* It was reported that browsers on Android 2.1 (and possibly older as well)
* need to have the filename extension upper-cased in order to be able to
* download it.
*
* Reference: http://digiblog.de/2011/04/19/android-and-the-download-file-headers/
*/
if (count($x) !== 1 && isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/Android\\s(1|2\\.[01])/', $_SERVER['HTTP_USER_AGENT'])) {
$x[count($x) - 1] = strtoupper($extension);
$filename = implode('.', $x);
}
// Clean output buffer
if (ob_get_level() !== 0) {
ob_clean();
}
// Generate the server headers
header('Content-Type: ' . $mime);
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Expires: 0');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . strlen($data));
// Internet Explorer-specific headers
if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header('Pragma: no-cache');
}
exit($data);
}
开发者ID:blekedeg,项目名称:lbhpers,代码行数:62,代码来源:download_helper.php
示例5: common_functions
public function common_functions()
{
echo is_php('5.3');
echo is_really_writable('file.php');
echo config_item('key');
echo set_status_header('200', 'text');
echo remove_invisible_characters('Java\\0script');
echo html_escape(array());
echo get_mimes();
echo is_https();
echo is_cli();
echo function_usable('eval');
}
开发者ID:psosulski,项目名称:ci,代码行数:13,代码来源:Examples.php
示例6: download
public static function download($uuid, $filename, $set_mime = TRUE)
{
$CI =& get_instance();
$config = $CI->config->item('utils');
list($secureId, $id, $path) = self::getData($uuid);
$filepath = $config['file_dir'] . $path . '/' . self::getFileName($id, $path) . '.backup';
$filesize = filesize($filepath);
$mime = 'application/octet-stream';
$x = explode('.', $filename);
$extension = end($x);
if ($set_mime === TRUE) {
if (count($x) === 1 or $extension === '') {
return;
}
$mimes =& get_mimes();
if (isset($mimes[$extension])) {
$mime = is_array($mimes[$extension]) ? $mimes[$extension][0] : $mimes[$extension];
}
}
if (count($x) !== 1 && isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/Android\\s(1|2\\.[01])/', $_SERVER['HTTP_USER_AGENT'])) {
$x[count($x) - 1] = strtoupper($extension);
$filename = implode('.', $x);
}
if (($fp = @fopen($filepath, 'rb')) === FALSE) {
return self::NOT_FOUND;
}
if (ob_get_level() !== 0 && @ob_end_clean() === FALSE) {
@ob_clean();
}
header('Content-Type: ' . $mime);
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Expires: 0');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . $filesize);
if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
header('Cache-Control: no-cache, no-store, must-revalidate');
}
header('Pragma: no-cache');
while (!feof($fp) && ($data = fread($fp, 1048576)) !== FALSE) {
echo $data;
}
fclose($fp);
exit;
}
开发者ID:ramadhanl,项目名称:sia,代码行数:44,代码来源:File.php
示例7: GetResults
public function GetResults()
{
$mimes =& get_mimes();
$rootFolderID = NULL;
$items = NULL;
$folders = array();
if (get_inventory($this->User['UserID'], $rootFolderID, $items)) {
foreach ($items as $item) {
$type = isset($mimes[$item['ContentType']]) ? $mimes[$item['ContentType']] : -1;
$folders[] = array('folder_id' => $item['ID'], 'name' => $item['Name'], 'parent_id' => $item['ParentID'], 'version' => (int) $item['Version'], 'type_default' => (int) $type);
}
} else {
log_message('error', 'Failed to fetch inventory skeleton for ' . $this->User['UserID']);
// Allowing the viewer to login with an empty inventory skeleton does bad things. Better
// to just bail out
exit;
}
log_message('debug', 'Returning ' . count($folders) . ' inventory folders in the skeleton');
return $folders;
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:20,代码来源:Class.inventory_skeleton.php
示例8: GetResults
public function GetResults()
{
$mimes =& get_mimes();
// Get the library owner ID
$userID = NULL;
if (!get_library_owner($userID)) {
log_message('warn', '[inventory_skel_lib] failed to get library owner');
return array();
} else {
// Get the root folder ID
$rootFolderID = $userID;
if (!get_library_root_folder($userID, $rootFolderID)) {
log_message('warn', '[inventory_skel_lib] failed to get library root');
return array();
}
// Get the items from the inventory folder
$items = NULL;
if (!get_inventory_items($userID, $rootFolderID, 0, $items)) {
log_message('warn', '[inventory_skel_lib] failed to get library contents');
return array();
}
// Build the output folder structure
$folders = array();
foreach ($items as $item) {
$type = isset($mimes[$item['ContentType']]) ? $mimes[$item['ContentType']] : -1;
$parentid = $item['ParentID'];
$folderid = $item['ID'];
$foldername = $item['Name'];
if ($folderid == $rootFolderID) {
$parentid = '00000000-0000-0000-0000-000000000000';
}
$folders[] = array('folder_id' => $folderid, 'name' => $foldername, 'parent_id' => $parentid, 'version' => (int) $item['Version'], 'type_default' => (int) $type);
}
log_message('debug', sprintf('[inventory_skel_lib] %d folders from %s owned by %s', count($folders), $rootFolderID, $userID));
return $folders;
}
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:37,代码来源:Class.inventory_skel_lib.php
示例9: qiniu_upload
function qiniu_upload($name, $type = 'gif|jpg|png')
{
$tmp_file = $_FILES[$name];
if (!isset($tmp_file['name']) || isset($tmp_file['name']) && empty($tmp_file['name'])) {
return '';
}
$minis =& get_mimes();
$type = explode('|', $type);
$flag = FALSE;
foreach ($type as $item) {
if (isset($minis[$item])) {
if (is_array($minis[$item]) && in_array($tmp_file['type'], $minis[$item]) || is_string($minis[$item]) && $tmp_file['type'] == $minis[$item]) {
$flag = TRUE;
}
}
}
if (!$flag) {
return FALSE;
}
$CI =& get_instance();
$CI->load->model('qiniu_model', 'qiniu');
if (isset($_SESSION['qiniu_token'])) {
$token = $_SESSION['qiniu_token'];
} else {
$token = $CI->qiniu->get_token();
$CI->session->set_tempdata('qiniu_token', $token, 3000);
}
$file_name = 'ci_set/' . date('Y/m/dH/i/s', time()) . md5(substr($tmp_file['name'], 0, strrpos($tmp_file['name'], '.')) . time()) . substr($tmp_file['name'], strrpos($tmp_file['name'], '.'));
$ret = $CI->qiniu->upload_file($token, $tmp_file['tmp_name'], $file_name);
if (isset($ret['key'])) {
return $ret['key'];
}
return FALSE;
}
开发者ID:webx32,项目名称:foyal_wechat,代码行数:34,代码来源:function_helper.php
示例10: __construct
/**
* Class constructor.
*
* Determines whether zLib output compression will be used.
*
* @return void
*/
public function __construct()
{
$this->_zlib_oc = (bool) ini_get('zlib.output_compression');
$this->_compress_output = $this->_zlib_oc === false && config_item('compress_output') === true && extension_loaded('zlib');
// Get mime types for later
$this->mimes =& get_mimes();
log_message('info', 'Output Class Initialized');
}
开发者ID:recca0120,项目名称:laraigniter,代码行数:15,代码来源:Output.php
示例11: view
public function view($file, $type)
{
global $ci, $page;
$file .= '.' . $type;
$type = strtolower($type);
$image = $compress = $deliver = $download = $stream = false;
if (preg_match('/^(jpe?g|gif|png|ico)$/', $type)) {
$image = $type;
} elseif (preg_match('/^(js|css|pdf|ttf|otf|svg)$/', $type)) {
$compress = $type;
} elseif (preg_match('/^(eot|woff2?|swf)$/', $type)) {
$deliver = $type;
} elseif (preg_match('/^(tar|t?gz|zip|csv|xls?x?|word|docx?|ppt|psd)$/', $type)) {
$download = $type;
} elseif (preg_match('/^(ogg|wav|mp3|mp4|mpeg?|mpg|mov|qt)$/', $type)) {
$stream = $type;
} else {
exit(header('HTTP/1.1 503 Not Implemented'));
}
if ($this->cached($file)) {
list($files, $updated) = $this->file_paths($file);
if (empty($files)) {
exit(header('HTTP/1.1 404 Not Found'));
}
$cache = array_shift($files);
// Only one file at a time is allowed now
$updated = array_shift($updated);
if (preg_match('/^.{5}\\/((~)?([0-9]{1,3})[x]{1}([0-9]{1,3})(:[0-9]{1,3})?)[\\/\\.]{1}/', $file, $matches)) {
$thumb = BASE_URI . 'thumbs/' . md5($cache) . '/' . rawurlencode($matches[1]) . '.' . $type;
if (!is_file($thumb) || filemtime($thumb) < $updated) {
// create the image thumb
require_once BASE . 'Page.php';
$page = new Page();
$thumbnail = $page->plugin('Image', 'uri', $cache);
if ($matches[2] == '~') {
$thumbnail->constrain($matches[3], $matches[4]);
} else {
$thumbnail->resize($matches[3], $matches[4], 'enforce');
}
$thumbnail->save($thumb, isset($matches[5]) ? min(substr($matches[5], 1), 100) : 80);
}
$cache = $thumb;
$updated = filemtime($thumb);
}
if (!$download && !$stream) {
$this->never_expires($updated);
}
if ($compress == 'pdf' || $download || $stream) {
$ci->load->driver('session');
$resource = str_replace(array(BASE_URI, BASE), '', $cache);
$resource .= '#' . substr(strstr($ci->uri->uri_string(), '/'), 1);
$ci->log_analytics('hits', $resource);
}
} elseif (strpos($file, 'CDN') !== false && is_file(BASE . $file)) {
$cache = BASE . $file;
$this->never_expires(filemtime($cache));
} elseif ($file == 'favicon.ico') {
$cache = dirname(__DIR__) . DIRECTORY_SEPARATOR . $file;
$this->never_expires(filemtime($cache));
} else {
exit(header('HTTP/1.1 404 Not Found'));
}
$mimes =& get_mimes();
header('Content-Type: ' . (is_array($mimes[$type]) ? array_shift($mimes[$type]) : $mimes[$type]));
if ($compress) {
$supported = isset($_SERVER['HTTP_ACCEPT_ENCODING']) ? $_SERVER['HTTP_ACCEPT_ENCODING'] : '';
$gzip = strstr($supported, 'gzip');
$deflate = strstr($supported, 'deflate');
$encoding = $gzip ? 'gzip' : ($deflate ? 'deflate' : 'none');
if (isset($_SERVER['HTTP_USER_AGENT']) && !strstr($_SERVER['HTTP_USER_AGENT'], 'Opera') && preg_match('/^Mozilla\\/4\\.0 \\(compatible; MSIE ([0-9]\\.[0-9])/i', $_SERVER['HTTP_USER_AGENT'], $matches)) {
$version = floatval($matches[1]);
if ($version < 6) {
$encoding = 'none';
}
if ($version == 6 && !strstr($_SERVER['HTTP_USER_AGENT'], 'EV1')) {
$encoding = 'none';
}
}
$cache = $type == 'css' ? $this->css_get_contents($cache, $file) : file_get_contents($cache);
if ($encoding != 'none') {
$cache = gzencode($cache, 9, $encoding == 'gzip' ? FORCE_GZIP : FORCE_DEFLATE);
header('Vary: Accept-Encoding');
header('Content-Encoding: ' . $encoding);
}
header('Content-Length: ' . strlen($cache));
exit($cache);
}
if (!($fp = fopen($cache, 'rb'))) {
header('HTTP/1.1 500 Internal Server Error');
exit;
}
$size = filesize($cache);
if ($download || $stream) {
ini_set('zlib.output_compression', 'Off');
$length = $size;
$start = 0;
$end = $size - 1;
if ($range = $ci->input->server('HTTP_RANGE')) {
// serve a partial file
if (preg_match('%bytes=(\\d+)-(\\d+)?%i', $range, $match)) {
//.........这里部分代码省略.........
开发者ID:kikoseijo,项目名称:BootPress,代码行数:101,代码来源:Resources_deliverer.php
示例12: __construct
/**
* Constructor
*
* @param array $props
* @return void
*/
public function __construct($config = array())
{
empty($config) or $this->initialize($config, FALSE);
$this->_mimes =& get_mimes();
$this->_CI =& get_instance();
log_message('info', 'Upload Class Initialized');
}
开发者ID:pdkhuong,项目名称:VideoFW,代码行数:13,代码来源:Upload.php
示例13: _mime_types
/**
* Mime Types
*
* @param string
* @return string
*/
protected function _mime_types($ext = '')
{
$ext = strtolower($ext);
$mimes =& get_mimes();
if (isset($mimes[$ext])) {
return is_array($mimes[$ext]) ? current($mimes[$ext]) : $mimes[$ext];
}
return 'application/x-unknown-content-type';
}
开发者ID:manis6062,项目名称:credituniversity,代码行数:15,代码来源:Email.php
示例14: force_download
/**
* Force Download
* 推动强迫下载
* Generates headers that force a download to happen
* 生成头文件强制下载发生
* @param string filename 文件名称
* @param mixed the data to be downloaded 下载的数据
* @param bool whether to try and send the actual file MIME type 是否要试着发送实际的文件的MIME类型
* @return void
*/
function force_download($filename = '', $data = '', $set_mime = FALSE)
{
if ($filename === '' or $data === '') {
return;
} elseif ($data === NULL) {
if (!@is_file($filename) or ($filesize = @filesize($filename)) === FALSE) {
return;
}
$filepath = $filename;
$filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename));
$filename = end($filename);
} else {
$filesize = strlen($data);
}
// Set the default MIME type to send 设置默认发送MIME类型
$mime = 'application/octet-stream';
$x = explode('.', $filename);
$extension = end($x);
if ($set_mime === TRUE) {
if (count($x) === 1 or $extension === '') {
/* If we're going to detect the MIME type, 如果我们要检测的MIME类型,
* we'll need a file extension. 我们需要一个文件扩展名。
*/
return;
}
// Load the mime types 加载mime类型
$mimes =& get_mimes();
// Only change the default MIME if we can find one 只改变默认的MIME如果我们能找到一个
if (isset($mimes[$extension])) {
$mime = is_array($mimes[$extension]) ? $mimes[$extension][0] : $mimes[$extension];
}
}
/* It was reported that browsers on Android 2.1 (and possibly older as well)
* need to have the filename extension upper-cased in order to be able to
* download it.
* 据报道,浏览器在Android 2.1(也可能是旧的)需要文件扩展名大写为了能够下载它。
* Reference参考: http://digiblog.de/2011/04/19/android-and-the-download-file-headers/
*/
if (count($x) !== 1 && isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/Android\\s(1|2\\.[01])/', $_SERVER['HTTP_USER_AGENT'])) {
$x[count($x) - 1] = strtoupper($extension);
$filename = implode('.', $x);
}
if ($data === NULL && ($fp = @fopen($filepath, 'rb')) === FALSE) {
return;
}
// Clean output buffer 干净的输出缓冲区
if (ob_get_level() !== 0 && @ob_end_clean() === FALSE) {
@ob_clean();
}
// Generate the server headers 生成服务器头信息
header('Content-Type: ' . $mime);
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Expires: 0');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . $filesize);
header('Cache-Control: private, no-transform, no-store, must-revalidate');
// If we have raw data - just dump it 如果我们有原始数据,将扔弃它
if ($data !== NULL) {
exit($data);
}
// Flush 1MB chunks of data 冲洗1MB的数据块
while (!feof($fp) && ($data = fread($fp, 1048576)) !== FALSE) {
echo $data;
}
fclose($fp);
exit;
}
开发者ID:anpone,项目名称:CodeIG,代码行数:77,代码来源:download_helper.php
示例15: __construct
/**
* Class constructor
*
* Determines whether zLib output compression will be used.
*
* @return void
*/
public function __construct()
{
// global $BM, $CFG;
$CFG =& load_class('Config', 'core');
$BM =& load_class('Benchmark', 'core');
$this->_zlib_oc = (bool) ini_get('zlib.output_compression');
$this->_compress_output = $this->_zlib_oc === FALSE && config_item('compress_output') === TRUE && extension_loaded('zlib');
// Get mime types for later
$this->mimes =& get_mimes();
log_message('info', 'Output Class Initialized');
}
开发者ID:cuongcody,项目名称:angularjs_elunchdemo,代码行数:18,代码来源:MY_Output.php
示例16: force_download
/**
* Force Download
*
* Generates headers that force a download to happen
*
* @param string filename
* @param mixed the data to be downloaded
* @param bool whether to try and send the actual file MIME type
* @return void
*/
function force_download($filename = '', $data = '', $set_mime = FALSE)
{
if ($filename === '' or $data === '') {
return;
} elseif ($data === NULL) {
if (@is_file($filename) && ($filesize = @filesize($filename)) !== FALSE) {
$filepath = $filename;
$filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename));
$filename = end($filename);
} else {
return;
}
} else {
$filesize = strlen($data);
}
// Set the default MIME type to send
$mime = 'webapps/octet-stream';
$x = explode('.', $filename);
$extension = end($x);
if ($set_mime === TRUE) {
if (count($x) === 1 or $extension === '') {
/* If we're going to detect the MIME type,
* we'll need a file extension.
*/
return;
}
// Load the mime types
$mimes =& get_mimes();
// Only change the default MIME if we can find one
if (isset($mimes[$extension])) {
$mime = is_array($mimes[$extension]) ? $mimes[$extension][0] : $mimes[$extension];
}
}
/* It was reported that browsers on Android 2.1 (and possibly older as well)
* need to have the filename extension upper-cased in order to be able to
* download it.
*
* Reference: http://digiblog.de/2011/04/19/android-and-the-download-file-headers/
*/
if (count($x) !== 1 && isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/Android\\s(1|2\\.[01])/', $_SERVER['HTTP_USER_AGENT'])) {
$x[count($x) - 1] = strtoupper($extension);
$filename = implode('.', $x);
}
if ($data === NULL && ($fp = @fopen($filepath, 'rb')) === FALSE) {
return;
}
// Clean output buffer
if (ob_get_level() !== 0 && @ob_end_clean() === FALSE) {
@ob_clean();
}
// Generate the server headers
header('Content-Type: ' . $mime);
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Expires: 0');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . $filesize);
// Internet Explorer-specific headers
if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
header('Cache-Control: no-cache, no-store, must-revalidate');
}
header('Pragma: no-cache');
// If we have raw data - just dump it
if ($data !== NULL) {
exit($data);
}
// Flush 1MB chunks of data
while (!feof($fp) && ($data = fread($fp, 1048576)) !== FALSE) {
echo $data;
}
fclose($fp);
exit;
}
开发者ID:super99199,项目名称:oasystem,代码行数:82,代码来源:download_helper.php
示例17: __construct
/**
* Class constructor
*
* Determines whether zLib output compression will be used.
*
* @return void
*/
public function __construct()
{
$this->_zlib_oc = (bool) @ini_get('zlib.output_compression');
// Get mime types for later
$this->mimes =& get_mimes();
log_message('debug', 'Output Class Initialized');
}
开发者ID:heruprambadi,项目名称:sispakar,代码行数:14,代码来源:Output.php
示例18: __construct
/**
* Constructor
*
* @param array $props
* @return void
*/
public function __construct($config = array())
{
empty($config) or $this->initialize($config, FALSE);
$this->_mimes =& get_mimes();
$this->_CI =& get_instance();
log_message('debug', 'Upload Class Initialized');
$this->_types = array('upload_userfile_not_set' => lang('Unable to find a post variable called userfile.'), 'upload_file_exceeds_limit' => lang('The uploaded file exceeds the maximum allowed size in your PHP configuration file.'), 'upload_file_exceeds_form_limit' => lang('The uploaded file exceeds the maximum size allowed by the submission form.'), 'upload_file_partial' => lang('The file was only partially uploaded.'), 'upload_no_temp_directory' => lang('The temporary folder is missing.'), 'upload_unable_to_write_file' => lang('The file could not be written to disk.'), 'upload_stopped_by_extension' => lang('The file upload was stopped by extension.'), 'upload_no_file_selected' => lang('You did not select a file to upload.'), 'upload_invalid_filetype' => lang('The filetype you are attempting to upload is not allowed.'), 'upload_invalid_filesize' => lang('The file you are attempting to upload is larger than the permitted size.'), 'upload_invalid_dimensions' => lang('The image you are attempting to upload doesn\'t fit into the allowed dimensions.'), 'upload_destination_error' => lang('A problem was encountered while attempting to move the uploaded file to the final destination.'), 'upload_no_filepath' => lang('The upload path does not appear to be valid.'), 'upload_no_file_types' => lang('You have not specified any allowed file types.'), 'upload_bad_filename' => lang('The file name you submitted already exists on the server.'), 'upload_not_writable' => lang('The upload destination folder does not appear to be writable.'));
}
开发者ID:rexcarnation,项目名称:XtraUpload-1,代码行数:14,代码来源:XU_Upload.php
示例19: get_mime_by_extension
/**
* Get Mime by Extension
*
* Translates a file extension into a mime type based on config/mimes.php.
* Returns FALSE if it can't determine the type, or open the mime config file
*
* Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience
* It should NOT be trusted, and should certainly NOT be used for security
*
* @param string path to file
* @return mixed
*/
function get_mime_by_extension($file)
{
$extension = strtolower(substr(strrchr($file, '.'), 1));
static $mimes;
if (!is_array($mimes)) {
$mimes =& get_mimes();
if (empty($mimes)) {
return FALSE;
}
}
if (isset($mimes[$extension])) {
return is_array($mimes[$extension]) ? current($mimes[$extension]) : $mimes[$extension];
}
return FALSE;
}
开发者ID:blekedeg,项目名称:lbhpers,代码行数:27,代码来源:file_helper.php
示例20: check_mime
function check_mime($file)
{
if (!is_file($file)) {
return;
}
if (!function_exists('finfo_open')) {
_log("NOT DEFINED | finfo_open", E_USER_ERROR);
}
if (!defined('FILEINFO_MIME_TYPE')) {
_log("NOT DEFINED | FILEINFO_MIME_TYPE", E_USER_ERROR);
}
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$type = finfo_file($finfo, $file);
finfo_close($finfo);
$nargs = func_num_args();
if ($nargs == 1) {
return $type;
}
$mimes = get_mimes(func_get_arg(1));
if (!isset($mimes[$type])) {
return false;
}
if ($nargs == 2) {
return true;
}
$check = func_get_arg(2);
if (!$check) {
return true;
}
return in_array(file_get_ext($file), $mimes[$type]);
}
开发者ID:ejz,项目名称:core,代码行数:31,代码来源:core.php
注:本文中的get_mimes函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论