mPDF实时上传不起作用
Posted
技术标签:
【中文标题】mPDF实时上传不起作用【英文标题】:mPDF realtime uploading not working 【发布时间】:2012-03-02 05:59:00 【问题描述】:我一直在尝试上传一个 mpdf 生成的文件,现在我遇到的问题是它没有将它放在我想要的目录中。
我的结构是这样的:
-应用程序-
-cgi-bin-
-文件- -系统-
-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】:尝试将您的上传路径更改为绝对路径而不是相对路径。
$config['upload_path'] = '/full/path/to/your/files';
【讨论】:
以上是关于mPDF实时上传不起作用的主要内容,如果未能解决你的问题,请参考以下文章