Guest User

bydlocode

a guest
May 11th, 2015
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1.  <?php
  2. require('fpdf.php');
  3. class PDF extends FPDF
  4. {
  5. function Header()
  6. {
  7.     $this->SetFont('Arial','B',15);
  8.     $this->Cell(80);
  9.     $this->Cell(30,10,'Title',1,0,'C');
  10.     $this->Ln(20);
  11. }
  12. function Footer()
  13. {
  14.     $this->SetY(-15);
  15.     $this->SetFont('Arial','I',8);
  16.     $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
  17. }
  18. }
  19.  
  20. if(isset($_FILES['documents'])){
  21.  $pdf = new FPDF( 'P', 'mm', 'A4' );
  22.  $pdf->AliasNbPages();
  23. foreach($_FILES['documents']['tmp_name'] as $key => $tmp_name)
  24. {
  25.     $file_name = $key.$_FILES['documents']['name'][$key];
  26.     $name      = strip_tags($_FILES['upload_file']['name']);
  27.     $file_size =$_FILES['documents']['size'][$key];
  28.     $file_tmp =$_FILES['documents']['tmp_name'][$key];
  29.     $file_type=$_FILES['documents']['type'][$key];  
  30.     $pdf->AddPage();
  31.     $pdf->Image($file_name,10,10,0,0);
  32.     move_uploaded_file($file_tmp,"./galleries".time().$file_name);
  33.    
  34. }
  35. $content = $pdf->Output('doc.pdf','F');
  36. }else{
  37.  
  38. echo "<form enctype='multipart/form-data' action='index.php' method='POST'>";
  39.  echo "File:<input name='documents[]' multiple='multiple' type='file'/><input type='submit' value='Upload'/>";
  40.  
  41.  echo "</form>";
  42. }
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment