Finding and displaying an uploaded image file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Muddasir
    New Member
    • Jun 2007
    • 49

    #1

    Finding and displaying an uploaded image file

    hi

    i am developing a small application, its basically a admin section where the admin can add/delete different items.

    like if he wants to add a product he just fills the form which contains the fields related to products.
    then the info obviously stored in db...
    but what i want to do is when the admin wants to add the image of the product.. i want to display that image against the product info......

    i am unable to do that........

    i have written a file upload code but it only uploads the file to specific folder only.......

    plz help me out

    thanks
  • nathj
    Recognized Expert Contributor
    • May 2007
    • 937

    #2
    Originally posted by Muddasir
    hi

    i am developing a small application, its basically a admin section where the admin can add/delete different items.

    like if he wants to add a product he just fills the form which contains the fields related to products.
    then the info obviously stored in db...
    but what i want to do is when the admin wants to add the image of the product.. i want to display that image against the product info......

    i am unable to do that........

    i have written a file upload code but it only uploads the file to specific folder only.......

    plz help me out

    thanks
    It would be really helpful to see some of the code you have in place. At what point do you wish to display the picture? Is the picture being loaded to the site and the URL stored in a database? What is the overview of how the system works?

    I'm sure help is around if there's a little more info.

    Nathan

    Comment

    • Muddasir
      New Member
      • Jun 2007
      • 49

      #3
      thanks for the reply Nathan

      i am using localhost. and all i want is that when i upload the image the image name also store in the database.

      i havn't done anythibg regarding this coz i have no clue how it will be done.. so it will be very kinf of you to show me the right direction.


      thanx

      Comment

      • bonski
        New Member
        • Jun 2007
        • 53

        #4
        Originally posted by Muddasir
        thanks for the reply Nathan

        i am using localhost. and all i want is that when i upload the image the image name also store in the database.
        hi there..
        you said you want to store the image name also to the db, right?
        on the upload script.. you should extract also the name of the image... using this for example..

        $filename = $_FILES['image']['name'];

        and store the data from the variable $filename to the table by INSERT SQL.. ok.

        and for displaying.. just query from the table where your image name is.. and you can try this for example..

        echo '<img src="'.$row['image_name'].'" alt="image"/>';

        this is an html tag to show image, right..
        and the variable $row[] is just an example when you use.. mysql_fetch_arr ay()
        and 'image_name' is just a field from the table.. just an example..

        hope this can give you a little.. have nice day.. ^____-

        Comment

        • Muddasir
          New Member
          • Jun 2007
          • 49

          #5
          thanx for help "bonski"

          it works now,,, thanks a lot

          Comment

          • bonski
            New Member
            • Jun 2007
            • 53

            #6
            ^_________^... a big smile... my pleasure buddy...

            Comment

            • pbmods
              Recognized Expert Expert
              • Apr 2007
              • 5821

              #7
              Changed thread title to better describe the problem.

              Comment

              Working...