Welcome Guest, Not a member yet? Register   Sign In
i am creating a pdf file using fpdf, and trying to upload that file to the server
#1

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

}
#2

[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.
#3

[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




Theme © iAndrew 2016 - Forum software by © MyBB