没有合适的资源?快使用搜索试试~ 我知道了~
codeigniter教程之多文件上传使用示例
1 下载量 150 浏览量
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币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Untitled2.m
- 昆虫检测321-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord、VOC数据集合集.rar
- wav音频活体检测(检测人声音出现消失的每段时间)
- 基于SSM的宠物领养管理系统源码+数据库+PPT(高分毕业设计项目)
- ±800 kV特高压直流输电工程双12脉动换流器在线投退控制策略分析-可复现论文-有问题请联系博主,博主会第一时间回复
- 基于条件对抗生成网络的无线信号去噪技术研究与应用-可复现论文-有问题请联系博主,博主会第一时间回复
- 开源tendisplus-2.7.0-rocksdb-v8.5.3.tgz
- 昆虫检测31-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord、VOC数据集合集.rar
- 根据excel数据批量生成word
- C++小游戏大全(0.10.1)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功