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

相关文章

PHP基于ffmpeg实现转换视频,截图及生成缩略图的方法

本文实例讲述了PHP基于ffmpeg实现转换视频,截图及生成缩略图的方法。分享给大家供大家参考,具体如下: 这里把ffmpeg 和  生成缩略图整合了一下: include...

php 不使用js实现页面跳转

在页面跳转的时候 一般使用都是js window.location.href 当然也可以使用复制代码 代码如下: <html> <head> <meta h...

php SQL之where语句生成器

复制代码 代码如下://生成where字符串 function get_where($arg = null) { foreach ((array)$arg as $key => $...

PHP生成随机数的方法总结

第一种方法用mt_rand() function GetRandStr($length){ $str='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKL...

PHP Header用于页面跳转要注意的几个问题总结

1.header()函数 header()函数是PHP中进行页面跳转的一种十分简单的方法。header()函数的主要功能是将HTTP协议标头(header)输出到浏览器。 header(...