0

So i have a set of code which will enter specific data from a .sql file into Wamp to use for a database and place it into a table this table has images in it which are from the www folder in wamp aswell as another source folder in my system. calling the images from the www folder works fine but it keeps having the images from the source folder as NULL even though the path is correct. Here is the table code

create table emp (
    Picture LONGBLOB DEFAULT NULL, 
    Picture_Path varchar(20) DEFAULT NULL
) 

Here is the table values

INSERT INTO emp (Picture, picture_path) 
VALUES
(load_file('c:/kittens/cat1.jpg'),'/cat1.jpg')

I tried to change make sure i didnt make any mistakes but i am new to SQL so i cant really be sure exactly what i did wrong

edit sorry i changed my original code to show the part i had an issue with there is more code but i forgot to adjust the text to have no comma at the end

  • You have an extra comma in the `CREATE TABLE` statement. – Barmar Jan 30 '23 at 18:06
  • Probably, assuming Apache is properly configured, because Apache is not allowed to access this other place on your disk – RiggsFolly Jan 30 '23 at 18:22
  • From [this old answer](https://stackoverflow.com/questions/8229951/how-to-use-load-file-to-load-a-file-into-a-mysql-blob), do you have `FILE` priv (look at `show grants`)? Or `secure_file_priv` setting in the server? or bigger than `max_allowed_packet`? – danblack Jan 31 '23 at 02:00
  • Ok i resolved by issue it appears in the myini file i had an extra line of code that seemed to be messing with my code and is working well now thank you all for your comments – Shane Munnelly Jan 31 '23 at 10:36

0 Answers0