Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
11-20-2013, 08:38 AM #1
- Join Date
- Jun 2013
- Thanked 0 Times in 0 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]...
INSERT INTO `image`(`ID`, `IMAGE`) VALUES ('4',LOAD_FILE('C:\xampp\htdocs\dbtry\images\google.png'));
so please suggest any useful link to Store & Retrieve image from database....
11-20-2013, 01:35 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,660 Times in 2,629 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...
header('HTTP/1.1 420 Enhance Your Calm');