加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – $_FILES [‘file’] [‘name’]在codeigniter中

发布时间:2020-12-13 16:20:29 所属栏目:PHP教程 来源:网络整理
导读:如何获取在codeigniter中上传的文件的文件名.我们将输入字段的值设为$this- input- post(‘name’),但是如何获取从表单上传的文件的名称? public function create(){ //getting all the POST data in $data array $data = array('title' = $this-input-post
如何获取在codeigniter中上传的文件的文件名.我们将输入字段的值设为$this-> input-> post(‘name’),但是如何获取从表单上传的文件的名称?

public function create(){

        //getting all the POST data in $data array
        $data = array('title' => $this->input->post('title'),'content' => $this->input->post('content'),'filename' => ?? HOW ??
        );
}

解决方法

1)确保你的表格是多部分的.使用帮助器form_open_multipart()

2)使用上传库接收文件

3)然后使用$this-> upload-> data()获得带有文件信息的数组

Here是如何和官方文档完整的

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读