Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require('fpdf.php');
- class PDF extends FPDF
- {
- function Header()
- {
- $this->SetFont('Arial','B',15);
- $this->Cell(80);
- $this->Cell(30,10,'Title',1,0,'C');
- $this->Ln(20);
- }
- function Footer()
- {
- $this->SetY(-15);
- $this->SetFont('Arial','I',8);
- $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
- }
- }
- if(isset($_FILES['documents'])){
- $pdf = new FPDF( 'P', 'mm', 'A4' );
- $pdf->AliasNbPages();
- foreach($_FILES['documents']['tmp_name'] as $key => $tmp_name)
- {
- $file_name = $key.$_FILES['documents']['name'][$key];
- $name = strip_tags($_FILES['upload_file']['name']);
- $file_size =$_FILES['documents']['size'][$key];
- $file_tmp =$_FILES['documents']['tmp_name'][$key];
- $file_type=$_FILES['documents']['type'][$key];
- $pdf->AddPage();
- $pdf->Image($file_name,10,10,0,0);
- move_uploaded_file($file_tmp,"./galleries".time().$file_name);
- }
- $content = $pdf->Output('doc.pdf','F');
- }else{
- echo "<form enctype='multipart/form-data' action='index.php' method='POST'>";
- echo "File:<input name='documents[]' multiple='multiple' type='file'/><input type='submit' value='Upload'/>";
- echo "</form>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment