загрузка в реальном времени mPDF не работает - PullRequest
0 голосов
/ 02 марта 2012

Я пытался загрузить сгенерированный в формате mpdf файл, теперь у меня проблема в том, что он не помещает его в нужный каталог.

Моя структура выглядит следующим образом:

-application-

-cgi-bin-

-files- -system-

-user_guide-

Вот код:

function save_answers()
{   
    $this->load->library('mpdf');
    $mpdf=new mPDF();
    $user = $this->ion_auth->get_user();
    $uid  = $user->id;
    $lid = $this->input->post('looper');
    $html = '';
    $html .= 'Examinee: '.$user->username;
    $html .= '<br />Date taken: '. date('Y-m-d').'<br />';
    for ($i=1; $i<=$lid; $i++) {
        $html .= 'Question: '.$this->input->post('qname_'.$i).'<br />';
        $html .= 'Answer: '.$this->input->post('answer_'.$i).'<br /><br />';

    }
    $html .= '<small><i>End of monthly exam. Ths is a system_generated item.</i></small>';

    $data['xid'] = $this->input->post('xid');
    $data['uid'] = $this->input->post('uid');
    $mpdf->WriteHTML($html);
    $filename = mt_rand(11111, 22222) + $uid;

    $data['pdf'] = $mpdf->Output($filename, 'D');

    $config['upload_path'] = 'files/';

    $config['max_size'] = '1000';
    $config['max_width'] = '1920';
    $config['max_height'] = '1280';                     

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

    if(!$this->upload->do_upload()) echo $this->upload->display_errors();
    else {
        $fInfo = $this->upload->data();
        #$this->_createThumbnail($fInfo['file_name']);

        $data['uploadInfo'] = $fInfo;
        $data['file_name'] = $filename;
        #$data['thumbnail_name'] = $fInfo['raw_name'] . '_thumb' . $fInfo['file_ext'];
        if($this->Exam_model->score_updater($data)) {
            $this->session->set_flashdata('msg_success', 'Successfully taken and saved');
            redirect('home', 'refresh');
        }

    }
    $mpdf->Output($filename, 'D');


}

1 Ответ

0 голосов
/ 03 марта 2012

Попробуйте изменить ваш upload_path на абсолютный вместо относительного.

$config['upload_path'] = '/full/path/to/your/files';
...