0

我的 csv 文件在本地上传完美,但是当我在我的网站上上传它时,它没有上传以下是我的上传功能

function upload_title()
{
    if(isset($_POST['upload_titles'])) // check if submit button is clicked
    {
        $config['upload_path'] = 'uploads/title/';
        $config['allowed_types'] = 'csv';
        $config['max_size'] = '5000';
        $config['overwrite']  = TRUE;
        $config['encrypt_name']  = TRUE;
        $config['remove_spaces']  = TRUE;

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

        $this->upload->do_upload();
        $temp = $this->upload->data('userfile');
        $article_titlelist = $temp['file_name'];



        if($this->upload->do_upload())
        {
            $this->load->library('csvreader');
            $result =   $this->csvreader->parse_file('./uploads/title/'.$article_titlelist);

            foreach($result as $val)
            {
                $articletitle = $val['title'];
                $title_category = $val['category'];
                $mDate = date('Y-m-d H:i:s');
                $data = array(
                        'article_title' => $articletitle,
                        'title_category' => $title_category,
                        'article_cdate' => $mDate,
                        'article_mdate' => $mDate
                        );
                $this->article_model->addtitle($data);
            }
            redirect('admin/article/title_listing');
        }
    }
    $error = array('error' => $this->upload->display_errors());
    $data['page_title'] = 'Article Title';
    $data['content'] = $this->load->view('admin/add_title', $error, true);
    $this->load->view('admin/template', $data);     
}

我已经在网上查过了,它没有进入 do_upload 状态

4

0 回答 0