www.webdeveloper.com
Results 1 to 2 of 2

Thread: Get an imagepath from DB and imagepath to display the pdf

  1. #1
    Join Date
    Aug 2013
    Posts
    1

    Get an imagepath from DB and imagepath to display the pdf

    Upload file code

    <?php
    //connecting to database
    $db = mysql_connect("localhost:3306","root","") or die(mysql_error());
    //selecting our database
    $db_select = mysql_select_db("uploadimage",$db) or die(mysql_error());
    if(isset($_POST['upload'])){//button for Upload
    $target_path = "uploads/";
    $target_path = $target_path . basename($_FILES['uploadedfile']['name']);
    if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    $query =mysql_query( "INSERT INTO image1 (name) values ('$target_path')");//insertion to database
    echo "The file " . basename($_FILES['uploadedfile']['name']) . " has been uploaded";
    header('Location: pdffile.php');
    }
    else {
    echo "There was an error uploading the file, please try again!";
    }
    }
    ?>




    fdpf code

    <?php
    require("fpdf.php");
    class PDF1 extends FPDF
    {
    // Page header
    function Header()
    {
    // Logo
    $this->Cell(0,10,'APPLICATION FORM FOR ADMISSION INTO MEDICAL PG DEGREE/DIPLOMA COURSES',0,0,'C');
    $this->Ln(6);
    $this->Cell(0,10,'UNDER MANAGEMENT QUOTA FOR THE ACADEMIC YEAR 2014-2015',0,0,'C');
    $this->Ln(6);
    $this->Cell(0,10,'-----',0,'C');
    // Line break
    $this->Ln(15);
    }
    }
    $link=mysql_connect('localhost:3306','root','');
    mysql_select_db('uploadimage');
    $pdf = new PDF1();
    $pdf->AddPage();
    $query=mysql_query("select name from image1 where id=1");
    $result = mysql_query($link, $query);
    header("Content-type: image/jpeg");
    $row=mysql_fetch_row($result);
    $name=$row[0];
    $pdf->Image($name);
    $pdf->Cell(0,10,'id'.$row['id'],0,1);
    $pdf->Cell(0,10,'name'.$row['name'],0,1);
    $pdf->Output(".pdf");
    header('Location: '. ".pdf");
    ?>

    Please help sir iwant to display the image in pdf from the imagepath

  2. #2
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    534
    Huh?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles