I want to insert longblob of file format jpeg, png, pdf and docx(other than .txt) to MySQL database. The file should be choosen from location and convert to longblob using nodejs and express. I do not want to use PHP, want to do it with javascript alone.
var fs = require('fs');
fs.readFile('uploads/image.png', 'base64', function(err1, data) {
if (err1) {
return console.log(err1);
}
var fileData = data;
console.log(fileData);
});
With the above code, I'm able to get data in base64, not sure about how to convert it to longblob.