0

First, I send the image file from android to node.js and I want to save the image file to the DB using node.js.

But I don't know how to do that.

This is my Node.js code

.post('/picture', upload.single('files'), (req,res)=>{
    res.json(req.file)
    console.log(req.body)
    console.log(req.file)
})

This is the result from req.file:

fieldname: 'files',
originalname: 'CHOIHYOGIL.png',
encoding: '7bit',
mimetype: 'image/png',
destination: 'images/',
filename: 'c98531598c04abda7e936ef310b147e9',
path: 'images\\c98531598c04abda7e936ef310b147e9',
size: 1372912

I want to save this image to my MySQL DB.

m02ph3u5
  • 3,022
  • 7
  • 38
  • 51
최효길
  • 41
  • 1
  • 5

1 Answers1

0

You could save the file locally and store the file directory in the table.

Venkatesh A
  • 1,875
  • 1
  • 19
  • 23