CodeIgniter Forums
i am creating a pdf file using fpdf, and trying to upload that file to the server - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: i am creating a pdf file using fpdf, and trying to upload that file to the server (/showthread.php?tid=58117)



i am creating a pdf file using fpdf, and trying to upload that file to the server - El Forum - 05-17-2013

[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);
}

}



i am creating a pdf file using fpdf, and trying to upload that file to the server - El Forum - 05-19-2013

[eluser]TheFuzzy0ne[/eluser]
Why are you using a form and requiring an uploaded file? I don't understand -- where does this report come from? Are you generating it from an uploaded file, or are you generating it from the database, or somewhere else?

If you're not wanting to upload a file, then you don't need to use the upload library.


i am creating a pdf file using fpdf, and trying to upload that file to the server - El Forum - 05-29-2013

[eluser]hebe_210[/eluser]
HI, Im not quite clear about this error, frankly I have ever created pdf from XML,but not fpdf.and I use the following codes.
Code:
RasterEdgePdfCreator pdf = new RasterEdgePdfCreator();
RasterEdgeXmlDocument xml = new RasterEdgeXmlDocument();
RasterEdgeXmlDocument xslt = new RasterEdgeXmlDocument();

//doc.FoImagePath = MapPath(".");
xml.Load(@"C/1.xml");
xslt.Load(@"C:/1.xslt");
doc.BindFO(xml, xslt);
doc.IsTruetypeFontMapCached = true;

doc.TruetypeFontMapPath = (@"d:/pdf/");
doc.Save(@C:/"T.pdf", SaveType.OpenInAcrobat,Response);
Does there exist commen erea?If yes ,you can turn to pdf creating guide in .NET. .Good luck