没有合适的资源?快使用搜索试试~ 我知道了~
codeigniter教程之多文件上传使用示例
1 下载量 178 浏览量
2020-12-18
13:38:08
上传
评论
收藏 52KB PDF 举报
温馨提示
复制代码 代码如下:<?php if(!defined(“BASEPATH”)){ exit(“No direct script access allowed”); } /** * Multi-Upload * * Extends CodeIgniters native Upload class to add support for multiple * uploads. * * @package CodeIgniter * @subpackage Libraries * @category Uploads */ class MY_Upload extends CI_
资源推荐
资源详情
资源评论
codeigniter教程之多文件上传使用示例教程之多文件上传使用示例
复制代码 代码如下:
<?php if(!defined(“BASEPATH”)){ exit(“No direct script access allowed”); }
/**
* Multi-Upload
*
* Extends CodeIgniters native Upload class to add support for multiple
* uploads.
*
* @package CodeIgniter
* @subpackage Libraries
* @category Uploads
*/
class MY_Upload extends CI_Upload {
/**
* Properties
*/
protected $_multi_upload_data = array();
protected $_multi_file_name_override = “”;
/**
* Initialize preferences
*
* @access public
* @param array
* @return void
*/
public function initialize($config = array()){
//Upload default settings.
$defaults = array(
“max_size” => 0,
“max_width” => 0,
“max_height” => 0,
“max_filename” => 0,
“allowed_types” => “”,
“file_temp” => “”,
“file_name” => “”,
“orig_name” => “”,
“file_type” => “”,
“file_size” => “”,
“file_ext” => “”,
“upload_path” => “”,
“overwrite” => FALSE,
“encrypt_name” => FALSE,
“is_image” => FALSE,
“image_width” => “”,
“image_height” => “”,
“image_type” => “”,
“image_size_str” => “”,
“error_msg” => array(),
“mimes” => array(),
“remove_spaces” => TRUE,
“xss_clean” => FALSE,
“temp_prefix” => “temp_file_”,
“client_name” => “”
);
//Set each configuration.
foreach($defaults as $key => $val){
if(isset($config[$key])){
$method = “set_{$key}”;
if(method_exists($this, $method)){
$this->$method($config[$key]);
} else {
$this->$key = $config[$key];
}
} else {
$this->$key = $val;
}
}
//Check if file_name was provided.
if(!empty($this->file_name)){
//Multiple file upload.
if(is_array($this->file_name)){
//Clear file name override.
$this->_file_name_override = “”;
//Set multiple file name override.
$this->_multi_file_name_override = $this->file_name;
//Single file upload.
} else {
//Set file name override.
$this->_file_name_override = $this->file_name;
//Clear multiple file name override.
$this->_multi_file_name_override = “”;
}
}
}
/**
* File MIME Type
*
* Detects the (actual) MIME type of the uploaded file, if possible.
* The input array is expected to be $_FILES[$field].
*
* In the case of multiple uploads, a optional second argument may be
* passed specifying which array element of the $_FILES[$field] array
* elements should be referenced (name, type, tmp_name, etc).
*
* @access protected
* @param $file array
* @param $count int
* @return void
*/
protected function _file_mime_type($file, $count=0){
//Mutliple file?
if(is_array($file[“name”])){
$tmp_name = $file[“tmp_name”][$count];
$type = $file[“type”][$count];
//Single file.
} else {
$tmp_name = $file[“tmp_name”];
$type = $file[“type”];
}
剩余7页未读,继续阅读
资源评论
weixin_38640473
- 粉丝: 8
- 资源: 949
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Java核心的DataX开源修改版设计源码,新增绿色数据库、SQL Server 2000、Tbase及Amazon S3插件支持
- 基于JavaScript的群友市场购买与打工小游戏设计源码
- 基于SpringBoot和Vue的简洁易学学生宿舍管理系统设计源码
- 基于BS架构与云端数据同步的云端巡检APP设计源码
- 基于Vue框架开发的网易云风格音乐平台设计源码
- 基于Servlet、JSP和JavaBean的JavaEE期末大作业设计源码
- 基于Python的xadmin前端设计源码及后端管理框架
- 基于Java语言的larvamall跳蚤商城设计源码
- 基于JavaScript的BOSS直聘批量打招呼自动化招聘工具设计源码
- ffmpeg爬虫-b站视频-情感分析.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功