1

I'm trying to insert the image in MySQL whenever i tried to add the image it showed null value. Pls help me to add the image. I've give the correct path but still error has occurred

create table image3(id int, image longblob not null);

insert into image3(id,image)values(571185, load_file('D:\Images\3.jpg'));
Bart Friederichs
  • 33,050
  • 15
  • 95
  • 195
chozhan
  • 181
  • 2
  • 17

1 Answers1

-2

The function load_file() returns the string representation of the file (it only works with text files).

What you're trying to do is insert binary data.

EDIT I was wrong, disregard the answer, instead look at this one: Load_File doesn't work

EDIT 2 Could it be that you have to use / instead of \? I know windows uses \ for path separators, but it's quite frankly the only OS to do so. Therefore I can imagine that MySQL (being multiplatform) uses "the correct separators".

Community
  • 1
  • 1
ToVine
  • 560
  • 5
  • 16