![]() |
failed to upload - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19) +--- Thread: failed to upload (/showthread.php?tid=67108) |
failed to upload - Corunum Archer - 01-16-2017 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; |