Posts

Showing posts with the label multer

“fake path” issue using multer+angular 6

“fake path” issue using multer+angular 6 I spend the last 3 days to fix the problem , but i didnt figure out yet the issue. Angular CLI: 6.0.8 Node: 8.11.2 OS: win32 x64 Angular: 6.0.6 multer. 1.3.1 my code at "childApi" using multer staff : var store = multer.diskStorage({ destination: function (req, file, cb) { cb(null, './uploads'); }, filename: function (req, file, cb) { cb(null, Date.now() + '.' + file.originalname); } }); var upload = multer({ storage: store , }).single('file'); router.post('/upload', function (req, res, next) { upload(req, res, function (err) { if (err) { return console.log ('not working well') } //do all database record saving activity return res.json({ originalname: req.file.originalname, uploadname: req.file.filename }); }); }); my code at "add-child" component using simple code : import { Component, OnInit, Injec...