79682189

Date: 2025-06-27 15:50:26
Score: 0.5
Natty:
Report link

Should read the image from node js file path and insert it as a blob. Then it works.

fs.readFile(path+image.filename, function(err, data) {
    if (err) throw err 

    var sql = 'Insert into table (id,image) VALUES ?';
    var values=[["1",data]]; 

    connection.query(sql,[values], function (err, data) {
        if (err) {
            // some error occured
            console.log("database error-----------"+err);
        } else {
            // successfully inserted into db
            console.log("database insert sucessfull-----------");
            
        }
    });


  })
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Jkk