如何使用CodeIgniter上传我在“upload”文件夹中上传的图像的文件名和文件路径?

时间:2016-07-27 03:38:03

标签: php codeigniter model-view-controller

这是我的控制器。

 function upload_file() { 
                $config['upload_path']          = './upload/';
                $config['allowed_types']        = 'iso|dmg|zip|rar|doc|docx|xls|xlsx|ppt|pptx|csv|ods|odt|odp|pdf|rtf|sxc|sxi|txt|psd|exe|avi|mpeg|mp3|mp4|3gp|gif|jpg|jpeg|png';
                $config['max_size']             = 3072;
                $config['max_width']            = 1024;
                $config['max_height']           = 768;
                $this->upload->initialize($config);
                $this->load->library('upload', $config);

                if (!$this->upload->do_upload('userfile'))
                {
                        $error = array('error' => $this->upload->display_errors());
                        $this->load->view('header');
                        $this->load->view('file', $error);
                        $this->load->view('footer');
                }
                else
                {
                        $data = array('upload_data' => $this->upload->data()); 
                        $this->load->view('header');
                        $this->load->view('file', $data);
                        $this->load->view('footer');
                }
    }

我该如何制作模特?我想上传文件名和上传图片的路径。

1 个答案:

答案 0 :(得分:0)

要显示图像,您可以按如下方式使用:

Me.IT_ORG_CODEComboBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.Pos_promotion_item_group_headersBindingSource, "IT_ORG_CODE", True))