没有合适的资源?快使用搜索试试~ 我知道了~
codeigniter教程之多文件上传使用示例
1 下载量 19 浏览量
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币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 在 MATLAB命令窗口中输入语句.pdf
- 1733798655610946_4310_129806678.html
- AI大模型微调实战训练营
- 基于Spring Cloud实现咖啡厅点单系统
- 中国大学计算机设计大赛基于python实现二维碎片拼接复原源码+ppt说明+项目说明.zip
- 基于Java的试题库管理系统的设计与实现:涵盖用户管理和在线测试等功能
- 软件开发中架构师如何利用软件建模和UML提升设计效能
- 基于 Koa + VueJ的宿舍管理系统(毕设,课设可参考)
- Character encoding autodetection in Ruby
- 创维47E700S 8R90机芯 LG屏 优朋网络版酷影最新升级软件,包含升级主程序、调试资料 主程序软件 电视刷机 固件升级包
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功