CI的新用户,我正在尝试使用我认为的好方法进行简单上传(发生了)它没有运行 .

简单的控制器,简单的表单视图,简单的模型,带有config参数的加载上传库userfile的路径(上传文件夹:777)是正确的

似乎是正常的过程,但不是文件夹中的文件,当我测试do_upload()时,我有假...?好像是do_upload();没被叫

Controller

class Ct_admin_add extends CI_Controller {  

        public function index()
    {
        $this->load->view('view_admin_header');
        $msg['msg_file'] = '';  

        $this->load->model('form_admin_add_model');

        if($this->input->post('Upload'))
        {
            $this->form_admin_add_model->do_upload();                       
        }

        $this->load->view('form_admin_add', $msg);  

        $this->load->view('view_admin_footer'); 
    }   
}

the View

<?php echo form_open_multipart('ct_admin_add');?>
<?php echo form_upload('userfile');?>
<?php echo form_submit('Upload', 'Charger');?>
<?php echo $msg_file; ?> <?php echo form_close(); ?>

the model

<?php
class Form_admin_add_model extends CI_Model{

    var $userfile_path;
        function __construct()
    {
        // Call the Model constructor
        parent::__construct();
        $this->userfile_path = APPPATH.'../userfile/';
    }

    function do_upload()
    {       
            $config = array(
            'upload_path' => $this->userfile_path,
            'allowed_types' => 'gif|jpg|png',
            'max_size'=> '100',
            'max_width'  => '1024',
            'max_height' => '768',
            'overwrite' => TRUE,
            'encrypt_name' => FALSE,
            'remove_spaces' => TRUE
            );

        $this->load->library('upload', $config);

        if ( ! is_dir($config['upload_path']) ) die("THE UPLOAD DIRECTORY DOES NOT EXIST");
        $test = $this->upload->do_upload();
        var_dump($test);        
    }
}

有小费吗?