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

yipeiwu_com6年前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']);
}

相关文章

如何使用脚本模仿登陆过程

查看他的登陆页面的代码, 看他提交到哪个页面, 变量是什么。复制代码 代码如下:<form method="post" action="lo...

php实现把url转换迅雷thunder资源下载地址的方法

本文实例讲述了php实现把url转换迅雷thunder资源下载地址的方法。分享给大家供大家参考。具体方法分析如下: 如果你知道迅雷地址的生成规则你就不觉得迅雷的url资源下载地址有多么复...

php数据库配置文件一般做法分享

config.php文件: 复制代码 代码如下: <?php $db_name="test"; $db_username="root"; global $db_password;...

php递归删除目录与文件的方法

本文实例讲述了php递归删除目录与文件的方法。分享给大家供大家参考。具体实现方法如下: <?php function deldir($path){ $dh = ope...

PHP中strtotime函数使用方法详解

在PHP中有个叫做strtotime的函数。strtotime 实现功能:获取某个日期的时间戳,或获取某个时间的时间戳。strtotime 将任何英文文本的日期时间描述解析为Unix时间...