NodeJS mySQL Insert Blob

后端 未结 4 1102
别跟我提以往
别跟我提以往 2020-12-20 17:03

I need a little help with NodeJS and MySQL blob insertion.

Here\'s the code snippet i\'m using

fs.open(temp_path, \'r\', function (status, fd) {
             


        
4条回答
  •  囚心锁ツ
    2020-12-20 18:05

    try using multer buffer:

    let query = "UPDATE yourtable SET image=? WHERE id = '1'"
    let obj = req.file.buffer;
    conn.query(query, obj, function (err, rows, fields) {})
    

提交回复
热议问题