Answer the question
In order to leave comments, you need to log in
How to save expressjs+nodejs file from Angular?
Hello. I can't find a google solution for my problem.
I use this https://github.com/danialfarid/ng-file-upload
On the server I use multer
var express = require('express');
var router = express.Router();
var multer = require('multer');
var upload = multer({ dest: 'public/uploads/'});
router.post('/', upload.single('file'), function(req, res) {
console.log(req.file);
res.status(200).json({ file: req.file});
});
module.exports = router;
Answer the question
In order to leave comments, you need to log in
In general, this is how the file was saved
fs.writeFile('public/uploads/image.jpg', req.file.buffer, 'ascii', function (err) {
if (err) throw err;
console.log('It\'s saved!');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question