load_file(path of file) is used to load file content as blob content in mysql database queries. It requires path of the file as parameter to read the data from the specified path to blob data.
|
How load_file method works in mysql
SELECT LOAD_FILE("d:/sample.txt");
|
Insert action using load_file to load blob content from specified file
INSERT INTO table_name (file_name,file_content) VALUES("data.txt",LOAD_FILE("d:/data.txt"));
INSERT INTO table_name (file_name,file_content) VALUES("sample.txt",LOAD_FILE("d:/sample.txt"));
|
Update blob using load_file method in MYSQL
UPDATE table_name SET file_content=LOAD_FILE("d:/data.txt") WHERE id = 1;
UPDATE table_name SET file_content=LOAD_FILE("d:/sample.txt") WHERE id = 2;
|