mysql-loadfile

How to insert image in mysql database(table)?

主宰稳场 提交于 2019-11-28 17:18:33
I want to insert image into a table like CREATE TABLE XX_SAMPLE(ID INT ,IMAGE BLOB); So can you help out form how to insert image into the above table. Madhav Please try below code INSERT INTO xx_BLOB(ID,IMAGE) VALUES(1,LOAD_FILE('E:/Images/jack.jpg')); You should use LOAD_FILE like so: LOAD_FILE('/some/path/image.png') You can try something like this.. CREATE TABLE 'sample'.'picture' ( 'idpicture' INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, 'caption' VARCHAR(45) NOT NULL, 'img' LONGBLOB NOT NULL, PRIMARY KEY('idpicture')) TYPE = InnoDB; or refer to the following links for tutorials and sample,

Upload image directly through mySQL Command Line

点点圈 提交于 2019-11-28 02:34:10
问题 I have a certain table in mySQL which has a field called "image" with a datatype of "BLOB". I was wondering if it is possible to upload an image in that field directly from the Command Line Client rather than doing it through php...If it is possible, then where exactly should I place my image files? 回答1: Try using the LOAD_FILE() function. UPDATE `certain_table` SET image = LOAD_FILE('/full/path/to/new/image.jpg') WHERE id = 1234; See the manual for requirements about the path to the filename

How to use LOAD_FILE to load a file into a MySQL blob?

混江龙づ霸主 提交于 2019-11-26 03:45:12
问题 I tried to load a file into a MySQL blob (on a Mac). My query is INSERT INTO MyTable VALUES(\'7\', LOAD_FILE(\'Dev:MonDoc.odt\')) No error appears but the file is not loaded into the blob. 回答1: The manual states the following: LOAD_FILE(file_name) Reads the file and returns the file contents as a string. To use this function, the file must be located on the server host, you must specify the full path name to the file, and you must have the FILE privilege. The file must be readable by all and