ci上传图片
2021-06-21 06:04
阅读:519
YPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
标签:logs dump http end Enctype size 允许 esc play
Upload Form
load->helper(array(‘form‘, ‘url‘)); } public function index() { $this->_viewData[‘title‘] = "test"; $this->_viewData[‘error‘] = ""; echo APPPATH; parent::index(); } public function do_upload() { header("content-type:text/html;charset=utf-8"); $config[‘upload_path‘] = ‘./upload/recommend‘; // 允许上传哪些类型 $config[‘allowed_types‘] = ‘gif|png|jpg|jpeg‘; // 上传后的文件名,用uniqid()保证文件名唯一 echo $config[‘file_name‘] = uniqid(); dump($_FILES); // 加载上传库 $this->load->library(‘upload‘, $config); dump($this->upload->data()); // 上传文件,这里的pic是视图中file控件的name属性 $result = $this->upload->do_upload(‘test‘); $a = $this->upload->display_errors(‘‘, ‘
‘); var_dump($a); // 如果上传成功,获取上传文件的信息 if ($result) { var_dump($this->upload->data()); } } }
ci上传图片
标签:logs dump http end Enctype size 允许 esc play
原文地址:http://www.cnblogs.com/php-linux/p/7183342.html
上一篇:TongWeb
下一篇:Struts文件上传机制
评论
亲,登录后才可以留言!