Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2013
    Thanked 2 Times in 2 Posts

    how to store Image/Url in mysql using php?

    I am trying to store an image with the following code , but the image data is filled with "Null" insted of [BLOB-3B]...
    PHP Code:
    INSERT INTO `image`(`ID`, `IMAGE`) VALUES ('4',LOAD_FILE('C:\xampp\htdocs\dbtry\images\google.png')); 
    ..... At the Same time i want to retrieve the image from the database .

    so please suggest any useful link to Store & Retrieve image from database....

  2. #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Saskatoon, Saskatchewan
    Thanked 2,662 Times in 2,631 Posts
    Nothing's wrong with that from the looks of it to me, but there are things that would stop it from functioning.
    LOAD_FILE has a great number of requirements as well: user must have the FILE privilege, accepts only up to max_allowed_packet (1MB default), and adheres to secure_file_priv specification. If the file can't be read or doesn't pass the above, than it returns null. Also, you should use the / or escape the backslashes. \x is what I'm looking at there; it likely isn't seeing the path as \xampp...
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


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