Adding file name from database to path

Discussion in 'HTML & Website Design' started by toshibata, Dec 6, 2011.

  1. #1
    Hello,

    I have a db where I saved the name of uploaded files. In order to display that image I want to state the path and add the filename from the db. Below is my code and where the problem is.

    $path = "example.com/CodeIgniter_1.7.2/uploads/"
    $image = "<img src="$path.''.$row['image'].'" WIDTH=300 HEIGHT=250>";
    Code (markup):
    Any help would be greatly appreciated.
     
    toshibata, Dec 6, 2011 IP
  2. ATmega Media

    ATmega Media Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $path = "example.com/CodeIgniter_1.7.2/uploads/";
    
    $image = "<img src='" . $path . $row["image"] . "' WIDTH=300 HEIGHT=250>";
    PHP:
     
    ATmega Media, Dec 6, 2011 IP
  3. madmod001

    madmod001 Peon

    Messages:
    14
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Quick note,
    to further on ATmega code
    make sure you define a path if the downloaded content is above the root
    which is the case for most websites that dont want the downloaded content harvested by a bot
     
    madmod001, Dec 7, 2011 IP