0
하나의 양식이 있습니다. 사용자가 양식을 제출하면 데이터베이스에 데이터를 저장하고 동일한 데이터를 PDF로 생성합니다. 여기 내가하고 싶은 것은 :Unale 런타임에 생성 된 파일을 디렉토리에 저장합니다.
- 다운로드 PDF 파일;
- PDF를 폴더에 저장하십시오.
PDF 다운로드가 제대로 작동하지만 폴더에 저장되지 않습니다.
public function get_pdf() {
$count = 1;
for ($i = 0; $i < count($_POST['description']); $i++) {
$table_data[] = array(
'serial' => $count,
'description' => $_POST['description'][$i],
'unit' => $_POST['unit'][$i],
'quantity' => $_POST['quantity'][$i],
'rate' => $_POST['rate'][$i],
'amount' => $_POST['amount'][$i]
);
$count++;
}
if (!empty($table_data)) {
// loading pdf library //
$this->load->library('cezpdf');
// field names //
$table_data_field = array(
'serial' => 'S.No.',
'description' => 'Work Description',
'unit' => 'Unit',
'quantity' => 'Quantity',
'rate' => 'Rate',
'amount' => 'Amount'
);
$this->cezpdf->ezTable($table_data, $table_data_field, 'Quotation', array('width' => 500, 'justification' => 'center'));
ob_start();
$this->cezpdf->ezStream();
$data = ob_get_contents();
ob_end_clean();
// save the quotation file on client folder //
move_uploaded_file('Quotation', FCPATH . '/quotation/' . $data);
// force to download the file //
$this->load->helper('download');
force_download('Quotation.pdf', $data);
}
}
도와주세요. 나는 CodeIgniter를 사용한다.
다음 david 솔루션 무엇입니까, 나는 우리가 사용하는 move_uploaded_file() 알고있는 파일을 통해 폼을 업로드하는 동안. 여기서 내가 무엇을 사용할 수 있습니까? 나는 인터넷을 통해 어떤 생각이나 도움을 얻지 못한다. – Ravi
대신에'rename'을 사용하십시오. –
문제 \t \t \t \t 는'// 클라이언트 폴더에 인용 파일을 저장 ... 대신 '인 move_uploaded_file()' 내가 'file_put_contents를()'여기 가 간다를 사용, 해결 // ' \t \t'file_put_contents를 (FCPATH '인용'DIRECTORY_SEPARATOR 'Quotation.pdf', $ 데이터...),' 감사 데이빗. – Ravi