не удалось показать сообщение об ошибке файла на странице просмотра в codeigniter

Я пытаюсь показать сообщение об ошибке загрузки изображения, используя flashdata но код, который показан ниже, не работает нормально. Что может быть причиной?

Пожалуйста, предложите мне решение проблемы.

mycontrollerPage.php

 class Booksetups extends CI_Controller { function book($book_id = 0) { $config = array(); $config['base_url'] = 'http://localhost/thexxr.com/Booksetups/book/pgn/'; $config["total_rows"] = $this->Booksmodel->record_count(); $config['uri_segment'] = 4; $config['per_page'] = 5; $config['full_tag_open'] = '<div id="pagination">'; $config['full_tag_close'] = '</div>'; //------------not wroking file upload error validation------------------------------------------ $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'gif|jpg|jpeg|png'; $config['max_size'] = '1000'; $config['max_width'] = '1920'; $config['max_height'] = '1280'; $config['remove_spaces'] = 'TRUE'; $config['file_path'] = 'TRUE'; $config['full_path'] = '/uploads/'; $this->load->library('upload', $config); $this->upload->do_upload("img1"); $this->upload->do_upload("img2"); //------------------------------------------------------------------------ $this->pagination->initialize($config); $page = ($this->uri->segment(4)) ? $this->uri->segment(4) : 0; $this->form_validation->set_error_delimiters('<div class="error">', '</div>')->set_rules('subject_id', 'subject_id','trim|required|min_length[1]|max_length[150]|xss_clean'); $this->form_validation->set_error_delimiters('<div class="error">', '</div>')->set_rules('cover_id', 'cover_id','trim|required|min_length[1]|max_length[150]|xss_clean'); $this->form_validation->set_error_delimiters('<div class="error">', '</div>')->set_rules('language_id', 'language_id','trim|required|min_length[1]|max_length[150]|xss_clean'); $this->form_validation->set_error_delimiters('<div class="error">', '</div>')->set_rules('edition_id', 'edition_id','trim|required|min_length[1]|max_length[150]|xss_clean'); if(($this->input->post('book_id'))&& ($this->form_validation->run() === TRUE)) { if( ! $this->upload->do_upload()) //trying to display error { $error = array('error' => $this->upload->display_errors()); $this->session->set_flashdata('error', $error); redirect(current_url()); } $this->session->set_flashdata('msg', '1 row(s) affected.'); $this->Booksmodel->entry_update(); redirect(current_url()); } } } 

Myview.php

 <?php echo '<fieldset><legend>'. $formtopic.'</legend>' ?> <?php echo validation_errors(); ?> <?php $message = $this->session->flashdata('msg'); if($message) { ?> <div class="success" id="msgdiv"><?php echo $this->session->flashdata('msg'); ?></div> <?php } ?> <?php $message = $this->session->flashdata('error'); if($message) { ?> <?php echo $error;?> <!-- Here i am getting. Message like "array" why not i am getting the error message instead? --> <?php } ?>