failed to upload |
controllers/Pages.php
$config['upload_path'] = '_assets'; $config['allowed_types'] = 'txt|php|htm'; $config['max_size'] = 0; $this->load->library('upload', $config); if ( $this->upload->do_upload('userfile') ) { $data = array('upload_data' => $this->upload->data()); $this->load->view('pages/dashboard/upload', $data); } else { $error = array('error' => $this->upload->display_errors() ); $this->load->view('pages/dashboard/'.$page, $error); } dashboard/upload.php <?php foreach ( $upload_data as $item => $value): ?> <li><?php echo @ $item;?>: <?php echo @ $value;?></li> <?php endforeach; ?> And the result was : Message: Undefined variable: upload_data Filename: dashboard/upload.php Line Number: 23 Line Number: 23 was "foreach ( $upload_data as $item => $value):" This happen when I tried using file that don't list at "$config['allowed_types']", Why this happen ? Why don't just return null or false; |
Messages In This Thread |
failed to upload - by Corunum Archer - 01-16-2017, 07:22 PM
|