Needs to update the image id extract from the submitted image?

Discussion in 'PHP' started by kcm4web, Aug 7, 2012.

  1. #1
    i just need help ..

    i am working on Image library where admin can upload multiple images with single category . The images are in this format like "ABC_12345_business","ABC_23567_business" etc. i want when i click submit button the images will insert into the database along with update the image id[e.g 12345,23567] in a separate row. so that it will easy for me to search the image by image id.

    can you pls explain me how to do it???
     
    kcm4web, Aug 7, 2012 IP
  2. Bhuvan14

    Bhuvan14 Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In the HTML
    <input type="file" name="photo">

    In the server side code,include this

    <?php
    $target = basename( $_FILES['photo']['name']);
    // now $target have ABC_12345_business.jpg
    //separte the target by '_' into array
    //take the arr[1] you illl get the id like 12345 and save into db
    ?>

    Try this it ill work.........

    Bhuvaneswaran
    A Web App Develper
     
    Bhuvan14, Aug 8, 2012 IP
  3. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #3
    1) DO NOT save the image in the database (for many reasons too complex to go into here), save it as a file on the server. Save its filename name (and image name if different) in the database.

    2) Since you already have one row for each image, search for the filename where image (or whatever you call the field with the name of the image) = the image you want.
     
    Rukbat, Aug 10, 2012 IP
  4. DomainerHelper

    DomainerHelper Well-Known Member

    Messages:
    445
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    100
    #4
    Agreed, you are really over complicating it and putting a heavy load onto your server.
     
    DomainerHelper, Aug 10, 2012 IP