Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2017
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to upload image in database using PDO

    i have tried this:
    image name:img


    $image=$_FILES['img']['name'];
    $image_tmp=$_FILES['img']['tmp_name'];
    move_uploaded_file($image_tmp,"../productimage/$image");

  2. #2
    New to the CF scene
    Join Date
    Nov 2017
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi,

    Try to use :

    $db->prepare("INSERT INTO blob ( name, image) VALUES ('$imageName', " . $db->quote($imageData) . ")");

  3. #3
    New to the CF scene
    Join Date
    Aug 2017
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanx

  4. #4
    New Coder
    Join Date
    Oct 2016
    Posts
    57
    Thanks
    3
    Thanked 1 Time in 1 Post
    You really shouldn't insert images into databases, it will slow them down and make the database a lot bigger. Plus, what is this doing in the HTML+CSS section?

  5. #5
    Senior Coder deathshadow's Avatar
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    2,468
    Thanks
    2
    Thanked 361 Times in 351 Posts
    ^
    |
    +--- This
    I would rather have questions that can't be answered, than answers that can't be questioned.
    http://www.cutcodedown.com


 

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
  •