0

When I run this query it only inserts NULL into the image column:

insert into imgblob('image') values(LOAD_FILE("C:\Users\Desktop\apple.png"));
Florian Humblot
  • 1,121
  • 11
  • 29
ipk
  • 21
  • 5
  • The conditions under which LOAD_FILE returns NULL are listed in the manual; resp. the conditions that must be met for this to work - so go check. And btw., binary image data does usually not belong into the database, the file system is the much more appropriate storage location for that. – CBroe May 31 '17 at 08:35
  • Not sure you may load the resource like that, try this INSERT INTO imgblob (image) VALUES(LOAD_FILE('c://apple.png')); – JazzCat May 31 '17 at 08:36

1 Answers1

0

Try LOAD_FILE('C:/Users/Desktop/apple.png') i.e "/" instead of "\" check this stackoverflow answer

ad3bay0
  • 123
  • 1
  • 9
  • i am still getting NULL – ipk May 31 '17 at 09:14
  • @ipk try using a single quote 'C:/Users/Desktop/apple.png' instead of double quote "C:\Users\Desktop\apple.png" if its still NULL can you show me your table structure for imgblob. – ad3bay0 May 31 '17 at 10:06
  • +---------------------------+ | image | +---------------------------+ | C:UsersKH9277Desktopapple | | NULL | | NULL | | NULL | | NULL | | NULL | | NULL | | NULL | | NULL | | NULL | | NULL | | NULL | | NULL | | NULL | +---------------------------+ 14 rows in set (0.00 sec) – ipk May 31 '17 at 10:19
  • @ipk i cant see the data type for the column image and i m sure you know the datatype should be "blob". Run this query --> alter table imgblob modify image longblob; to make your column blob compartible then try your insert query again. – ad3bay0 May 31 '17 at 11:05