SWFUpload与CI不能正确上传识别文件MIME类型解决方法分享

yipeiwu_com5年前PHP代码库
解决方案如下,其它框架雷同。

源代码(/system/libraries/upload.php 199 line)

$this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES[$field]['type']);

修改成如下:

复制代码 代码如下:

//Edit By Tacker
if(function_exists('mime_content_type')){
$this->file_type = preg_replace("/^(.+?);.*$/", "\\1", mime_content_type($this->file_temp));
}else{
$this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES[$field]['type']);
}

相关文章

php关联数组与索引数组及其显示方法

数据 username password test 123456 关联数组: mysql_fetch_assoc() array([username]=>'test...

PHP实现Unicode编码相互转换的方法示例

本文实例讲述了PHP实现Unicode编码相互转换的方法。分享给大家供大家参考,具体如下: <?php /** * $str 原始中文字符串 * $encoding 原...

浅析PKI加密解密 OpenSSL

点击下载OpenSSL window与linux要区分的 解压文件 双击: Win32OpenSSL-0_9_8l_95895.exe 安装完毕后 \OpenSSL\bin\opens...

php使用ereg验证文件上传的方法

本文实例讲述了php使用ereg验证文件上传的方法。分享给大家供大家参考。具体分析如下: ereg格式如下: 复制代码 代码如下:ereg(正规表达式,字符串,[匹配部分数组名]); 这...

PHP安装memcache扩展的步骤讲解

PHP安装memcache扩展的步骤讲解

PHP 5.6.23,查询目前最稳定的版本是memcache-2.2.7。 1.下载并解压缩。 wget http://pecl.php.net/get/memcache-2.2.7....