栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

无法从Codeigniter中的1个表单保存2个文件

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

无法从Codeigniter中的1个表单保存2个文件

请尝试此更新的功能。您正在做一些奇怪的事情,例如初始化第一个而不是第二个。由于CI是单例,因此可能会导致某些问题(不是说这是根本原因)。

        $this->load->library('upload');        echo '<pre>';        print_r($_FILES);        $config['upload_path'] = './assets/file/.';        $config['allowed_types'] = 'gif|jpg|png|doc|txt';        $config['max_size'] = 1024 * 8;        $config['encrypt_name'] = TRUE;        $this->upload->initialize($config);        if (!$this->upload->do_upload('file-upload')) { $error = array('error' => $this->upload->display_errors()); print_r($error);        } else { $data = $this->upload->data(); echo $res = $data['file_name'];        }        $config2['upload_path'] = './assets/img/.';        $config2['allowed_types'] = 'gif|jpg|png|doc|docx|txt';        $config2['max_size'] = 1024 * 8;        $config2['encrypt_name'] = TRUE;        $this->upload->initialize($config2, true);        if (!$this->upload->do_upload('imgupload')) { $error1 = array('error' => $this->upload->display_errors()); print_r($error1);        } else { $data1 = $this->upload->data(); echo $res1 = $data1['file_name'];        }

如果不起作用。请让我们知道

$_FILES
阵列正在打印什么。

更新:

没用是因为

$this->load->library('upload',$config2);
。当CI看到加载时,它将首先检查是否加载了该类,而与传递的参数无关,因为已经加载了该类,因此忽略了该行,并使用了
$config
(第一次上传图像)中的设置。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/401780.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号