Codeigniter - 致命错误
我有这个错误,致命错误:在第 219 行调用 D:\xampp\htdocs\application\controllers\page.php 中的未定义方法 CI_Input::file()
并使用 使用 JQuery 和 Code Igniter 进行多次上传 和文件扩展输入
这是我的代码:
if($this->input->file('userfile')){ //This is line 219
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '1000';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->upload->initialize($config);
$this->load->library('Multi_upload');
$files = $this->multi_upload->go_upload();
//var_dump($files);
if ( ! $files )
{
$error = $this->upload->display_errors();
echo $error;
return false;
}
else
{
$data3 = array();
foreach ($files as $idx => $name) {
//var_dump($name['name']);
$data3[] = array(
'relation' => $id_residence,
'images' => $name['name'],
);
};
$data333 = $this->db->insert_batch('hotel_image', $data3);
}
}
I have this error, Fatal error: Call to undefined method CI_Input::file() in D:\xampp\htdocs\application\controllers\page.php on line 219
and use from Multiple Uploads with JQuery and Code Igniter and Extended Input for Files
This is my code:
if($this->input->file('userfile')){ //This is line 219
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '1000';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->upload->initialize($config);
$this->load->library('Multi_upload');
$files = $this->multi_upload->go_upload();
//var_dump($files);
if ( ! $files )
{
$error = $this->upload->display_errors();
echo $error;
return false;
}
else
{
$data3 = array();
foreach ($files as $idx => $name) {
//var_dump($name['name']);
$data3[] = array(
'relation' => $id_residence,
'images' => $name['name'],
);
};
$data333 = $this->db->insert_batch('hotel_image', $data3);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
而不是
isset()
尝试:
Instead of
isset()
try: