SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2009
    0 Post(s)
    0 Thread(s)

    Uploading image details from db with image from server


    i hope somebody can help me, i'm trying to build a website which displays my .jpg's images stored on my server along with it's information e.g image description stored on my mysql db together. I've got to the point where i can display my text successfully, however i don't know how to display my .jpg's along with my text.

    I've been scouring the net for a good couple of hours tyring different search combinations, but so far i've only found tutorials where the image is stored on the db and is then uploaded with it's corresponding text/info also stored on the db and is displayed on the browser.

    My site does not have a form to upload images to the server as i am simply dragging and dropping the images directly into my server manually into my desired folders.

    I'm not asking for code, but all i'm asking is for somebody to point me in the right direction to some good tutorials that will do what i want, essentailly upload image file from my server along with my text(info) to be displayed on my web page.

    Please help if u can.

  2. #2
    SitePoint Member dabaR's Avatar
    Join Date
    Jun 2010
    Winnipeg, MB, Canada
    0 Post(s)
    0 Thread(s)
    Are you saying upload the images to the server through the browser, or just display the images in the page?

    It sounds like you already have a database; here is a simplified version for the sake of the example:

    Image - id, description, filename

    So you start with a form which allows you to upload the file, shows a pretty good tutorial.

    Once you've sent the file to your server, the PHP script on the other end could start by saving description and filename to the database, the obtain the ID, which is auto-incrementing, and use that to store the image in images/$id/$filename

    Later on when displaying the image, you could do something like:
    foreach ($images as $image) {
    '<img alt="" src=".../images/'.$image['id'].'/'.$image['filename'].'" />');
    I hope that helps!
    Dan Bernardic

    Last edited by mizwizzy; Jun 2, 2010 at 03:28. Reason: removed fake signature - please be patient...


Posting Permissions

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