CI支持各种文件上传-文件类型(Linux + window)
$mimes = array( 'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro',
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'),
'bin' => 'application/macbinary',
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => array('application/octet-stream', 'application/x-msdownload'),
'class' => 'application/octet-stream',
'psd' => 'application/x-photoshop',
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'ai' => 'application/postscript',
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'php' => 'application/x-httpd-php',
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => 'application/x-javascript',
'swf' => array('application/x-shockwave-flash','application/octet-stream'),
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'rar' => array('application/x-rar-compressed', 'application/x-rar', 'application/rar', 'application/octet-stream'),
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/octet-stream'),
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff',
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
'bmp' => array('image/bmp', 'image/x-windows-bmp'),
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg','application/octet-stream'),
'jpg' => array('image/jpeg', 'image/pjpeg','application/octet-stream'),
'jpe' => array('image/jpeg', 'image/pjpeg','application/octet-stream'),
'png' => array('image/png', 'image/x-png','application/octet-stream'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'css' => 'text/css',
'html' => 'text/html',
'htm' => 'text/html',
'shtml' => 'text/html',
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => 'text/xml',
'xsl' => 'text/xml',
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => 'video/x-msvideo',
'movie' => 'video/x-sgi-movie',
'pdf' => array('application/pdf', 'application/x-download', 'application/octet-stream'),
'doc' => array('application/msword','application/octet-stream'),
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword','application/x-zip', 'application/octet-stream'),
'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel', 'application/x-zip','application/msword', 'application/octet-stream'),
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/x-zip', 'application/vnd.ms-excel', 'application/octet-stream'),
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'),
'pptx' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'),
'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => array('application/json', 'text/json')
);
CI支持各种文件上传-文件类型(Linux + window)的更多相关文章
- WebService支持多平台上传文件的实现
WebService支持多平台上传文件的实现 要使用网站上传文件,在ASP.NET的范畴,我基本上能想到的有两类,一类是通过HTTP POST请求获得文件信息,另外一类是通过WebService或 ...
- Struts2框架下的文件上传文件类型、名称约定
Struts2框架下的文件上传机制:1.通过multipart/form-data form提交文件到服务器2.文件名是通过什么地方设置的?在strust2的FileUploadInterceptor ...
- php文件上传判断类型
上传文件对象在$_FILES['Filedata']对象中,临时路径是tmp_name,判断是上传文件是否为真实图片方法很多,我用的是这个: if( !@getimagesize( $_FILES[' ...
- 文件上传 MIME类型检测
简介 MIME(Multipurpose Internet Mail Extensions)多用途网络邮件扩展类型,可被称为Media type或Content type, 它设定某种类型的文件当被浏 ...
- 扩展 ajaxupload.js ,支持客户端判断上传文件的大小
onSubmit: function(file, extension){}, 修改为 onSubmit: function(file, extension, size){}, if (! (setti ...
- PHP文件上传错误类型及说明
从 PHP 4.2.0 开始,PHP 将随文件信息数组一起返回一个对应的错误代码.该代码可以在文件上传时生成的文件数组中的 error 字段中被找到,也就是 $_FILES['userfile'][' ...
- element-ui文件上传 做类型大小的限制
上代码: <div class="filebox"> <el-upload class="upload-demo" :action=" ...
- MVC文件上传文件限制
最近想实现MVC中文件上传限制,总觉得有便利的方法,找了半天就找到加属性accept <input type="file" id="file" name= ...
- 超大文件上传到Azure Linux虚拟机最佳实践
客户在实际进行迁移的时候,往往碰到需要将本地数据中心的超大文件,比如单个200GB的文件,或者总共1TB的无数文件上传到Azure上的情况,尤其是传到Azure的Linux虚拟机的场景,这种场景包括: ...
- django中处理文件上传文件
1 template模版文件uploadfile.html 特别注意的是,只有当request方法是POST,且发送request的<form>有属性enctype="multi ...
随机推荐
- [js综合问题汇总]js窗口关闭事件,表单名称,父窗口子窗口,var变量名
<script type="text/javascript"> window.onbeforeunload = onbeforeunload_handler; //wi ...
- 电商安全无小事,如何有效地抵御 CSRF 攻击?
现在,我们绝大多数人都会在网上购物买东西.但是很多人都不清楚的是,很多电商网站会存在安全漏洞.比如乌云就通报过,国内很多家公司的网站都存在 CSRF 漏洞.如果某个网站存在这种安全漏洞的话,那么我们在 ...
- linux ubuntu 11.04 samba 服务器设置
安装 SAMBA 组件 sudo apt-get install samba smbfs smbclient 配置相关参数 sudo gedit /etc/samba/smb.conf 文件中相关 ...
- select下拉框选择触发事件
我一直以来都认为,select 下拉框选择对选项 options 使用 onclick 注册事件即可,如下: <select> <option value="0" ...
- git 命令整理
记录一些git 命令,以便自己以后查阅 基本命令 1.git add (保存工作区的变动到暂存区) git add . 和git add -A把整个工作区添加到暂存区 2.git commit ( ...
- http://jingyan.baidu.com/article/a3761b2b66fe141577f9aa51.html
http://jingyan.baidu.com/article/a3761b2b66fe141577f9aa51.html
- nginx比较apache
http://blog.csdn.net/hanghangaidoudou/article/details/8506963 话说nginx在大压力的环境中比apache的表现要好,于是下载了一个来折腾 ...
- Maven学习总结(四)——Maven核心概念
一.Maven坐标 1.1.什么是坐标? 在平面几何中坐标(x,y)可以标识平面中唯一的一点. 1.2.Maven坐标主要组成 groupId:组织标识(包名) artifactId:项目名称 ver ...
- P163、面试题29:数组中出现次数超过一半的数字
题目:数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字.例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}.由于数字2在数组中出现了5次,超过数组长度的一半,因此输出2. 思 ...
- Java命令行实用工具jps和jstat
在Linux或其他UNIX和类UNIX环境下,ps命令想必大家都不陌生,我相信也有不少同学写过 ps aux | grep java | grep -v grep | awk '{print $2}' ...