ci框架文件上传
控制器类代码
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Upload extends CI_Controller {
public function index()
{
$this->load->view('up');
}
function up(){
if(!empty($_POST['sub'])){
$file=$_FILES['upfile'];
if($file['size']>=200000){
echo 'size no';
}
else{
switch ($file['type']){
case 'image/png':
$hou='.png';
break;
default:
$hou=false;
break;
}
if($hou){
$time=time();
move_uploaded_file($file['tmp_name'], "./upload/$time$hou");
}
else{
echo 'type no';
}
}
}
}
function up1(){
$config['upload_path']='./upload';
$config['allowed_types']='gif|jpg|png';
$config['max_size']='2000';
$this->load->library('upload',$config);
if($this->upload->do_upload('upfile')){
$data=array('upload_data'=>$this->upload->data());
var_dump($data);
}
else{
$error=array('error'=>$this->upload->display_errors());
var_dump($error);
}
}
}
ci框架文件上传的更多相关文章
- ssh框架文件上传下载
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 第二百七十三节,Tornado框架-文件上传
Tornado框架-文件上传 第一.普通表单上传文件 self.request.files["fafafa"] 获取上传文件信息,参数["上传文件框的name名称&quo ...
- ci框架读取上传的excel文件数据
原文链接: https://blog.csdn.net/qq_38148394/article/details/87921373 此功能实现使用到PHPExcel类库,PHPExcel是一个PHP类库 ...
- SSH,SSM框架文件上传
一.了解文件上传 1.1 什么是文件上传 将本地文件通过流的形式写到服务器上 1.2 文件上传的技术 JspSmartUpload: 其组件是应用jsp进行B/S程序开发过 ...
- tp框架-----文件上传
之前也做过文件上传,现在学了tp,用tp怎么做呢? 第一步:做一个Wenjian控制器: <?php namespace Ceshi\Controller; use Think\Controll ...
- 文件上传—SSM框架文件上传
1.准备上传下载的api组件 <dependency> <groupId>commons-io</groupId> <artifactId>common ...
- tp 框架 -文件上传
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 <?ph ...
- Android采取async框架文件上传
页面效果 须要的权限 <uses-permission android:name="android.permission.INTERNET"/> 网络訪问权限; 布局文 ...
- 文件上传—SSH框架文件上传
1.准备上传的api组件 <dependency> <groupId>commons-io</groupId> <artifactId>commons- ...
随机推荐
- leetcode 【 Find Minimum in Rotated Sorted Array II 】python 实现
题目: Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed? W ...
- 什么是事务?MySQL如何支持事务?
什么是事务? 事务是由一步或几步数据库操作序列组成逻辑执行单元,这系列操作要么全部执行,要么全部放弃执行.程序和事务是两个不同的概念.一般而言:一段程序中可能包含多个事务.(说白了就是几步的数据库操作 ...
- day05_07 标志位讲解
continue: 需求:大于5才打印 for i in range(10): if i<6 : continue print(i) continue作用:结束本次循环,继续下次循环 break ...
- 使用make构建c程序
1.Targets, Prerequisites, Commands Targets: 大意是生成的可执行文件. Prerequisites: 生成可执行文件的目标文件或C 语言源文件. Target ...
- 玲珑杯”ACM比赛 Round #15
手速狗从西安回来一只浑浑噩噩,好不容易迎来一场送饭比赛体验一把河南的优势,结果被高中生狂虐,无缘奖金..我的奖品梦就这样一次次被打破.... A -- Reverse the lights 最后半小时 ...
- 论S B的自我修养 【2015/10/18更】
to do list: 1.正则表达式引擎 (done 2.五子棋AI jquery && canvas 游戏 (这个搞定好多好玩的idea可以实现了php 暂时不想玩各种框架吧, ...
- [暑假集训--数论]poj1595 Prime Cuts
A prime number is a counting number (1, 2, 3, ...) that is evenly divisible only by 1 and itself. In ...
- POJ1716 Integer Intervals
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13984 Accepted: 5943 Description An i ...
- POJ 2891
Strange Way to Express Integers Time Limit: 1000MS Memory Limit: 131072K Total Submissions: 19509 ...
- ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: YES)
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO) ERROR 1045 (28000 ...