copy paste support

This commit is contained in:
anarch3 2022-11-16 07:36:27 -05:00
parent adeda1b0f5
commit 3bd9d47a3c
4 changed files with 27 additions and 3 deletions

View file

@ -75,12 +75,15 @@ router.get('/', function (req, res, next) {
router.post('/', upload.array('fileupload'), function(req, res, next) {
if (!req.files || Object.keys(req.files).length === 0) {
console.log(req)
return res.status(400).send('No files were uploaded.');
}
for (file in req.files) {
db.run('INSERT INTO media (path) VALUES (?)', [req.files[file].filename], function (err) {
if (err) return next(err);
if (err) { console.log(err)
return next(err);
}
return res.redirect('/');
})
}