[eluser]dinisptc[/eluser]
i am creating a pdf file using fpdf, and trying to upload that file to the server
can i do it without the upload_form ?
i am getting this error
Array ( [error] =>
You did not select a file to upload.
)
Code:
public function create_report_pdf()
{
//require('fpdf.php');
$this->load->library('fpdf');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
//$pdf->Output();
$pdf->Output('/home/pedro/customerfiles/hello.pdf','F');
$config['file_name'] = '/home/pedro/customerfiles/hello.pdf';
$config['upload_path'] = '/home/pedro/customerfiles/24';
$config['allowed_types'] = 'pdf';
$config['max_size'] = '2000';
$config['encrypt_name'] = true;
//$config['overwrite'] = TRUE;
$this->upload->initialize($config);
//$form_name = “photo_” . $i;
if ( ! $this->upload->do_upload('userfile'))
{
$error = array('error' => $this->upload->display_errors());
print_r($error);
}
else
{
$data = array('upload_data' => $this->upload->data());
print_r($data);
//$this->load->view(‘upload_success’, $data);
}
}