0
这里是上传功能:笨照片上传在非允许的类型没有错误警告文件
$config['upload_path'] = './photos/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 1024 * 2;
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
//$this->upload->initialize($config);
if (!$this->upload->do_upload("photo_data"))
{
$this->error = true;
$this->response = $this->upload->display_errors('', '');
}
else
{
$this->upload->data();
$this->response = "Photo successfully changed.";
}
$array = array(
'error' => $this->error,
'response' => $this->response
);
return $array;
不过,为了测试它不容许的文件类型,除了一个,我让我改名的视频,以.JPG并试图把它上传...
它没有继续进行,但它没有也发送一个错误信息......我在upload class
returns false
somwhere想......任何想法如何确保它发送一条消息给用户至上?
这就是我怎么打印错误:<?PHP的,如果(isset($ U pload_data [“error”])):?>
<?php endif; ?> 事情是,它不进入任何有条件的,如果文件是从一个视频重新命名.jpg在任何情况下.... – fxuser 2012-02-24 20:37:24你在哪里设置$ upload_data变量?我没有在你发布的代码中看到它...... Sidenote(和不相关的):你传递$ config两次,不管是在加载库还是使用初始化时传递它作为第二个参数,而不是 – 2012-02-24 20:46:56
它在用户类数组被发送到视图,所以我回应错误,如果我有上传后完成任何错误 – fxuser 2012-02-24 20:54:03