Welcome Guest, Not a member yet? Register   Sign In
failed to upload
#1

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;
Reply




Theme © iAndrew 2016 - Forum software by © MyBB