在我的网络应用程序中,我必须上传图像。在该检查文件是否上传,如果这不上传不显示任何错误消息
查看
public function shopped()
{
$config['upload_path'] = './application/assets/images/shops';
$config['allowed_types'] = 'jpg';
$this->load->library('upload', $config);
$id=$this->input->post('shop_name');
$type=$this->input->post('type');
$this->form_validation->set_error_delimiters('<div class="error" style="color:red">', '</div>');
$this->form_validation->set_rules('shop_name','Business Type','required');
$this->form_validation->set_rules('type',' shop type','required|alpha');
if ($this->form_validation->run() == FALSE)
{
$this->viewcategories();
}
else if (!$this->upload->do_upload('userfile'))
{
$error = array('error' => $this->upload->display_errors());
$this->viewcategories($error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->businesstype_model->getshop($id,$type);
$success_message='Successfully Added!';
$this->session->set_flashdata('success_message',$success_message);
redirect(base_url().'admin/businesstype/viewcategories');
}
}
viewcategory功能
public function viewcategories()
{
$nam=$this->input->post('name');
$rec=$this->businesstype_model->getdata();
$rec_array=array('rec_name'=>$rec);
$this->load->view('admin/header',$rec_array);
$this->load->view('admin/addshop_view',$rec_array);
$this->load->view('admin/footer',$rec_array);
}
我想在addshop_view
上显示错误消息如果条件不起作用,则在我的其他地方出现错误消息。该原因是什么..
psp给出了一个建议..答案 0 :(得分:0)
尝试将其放入addshop_view
// Report all PHP errors
error_reporting(E_ALL);
或者
// Report all PHP errors
error_reporting(-1);