- Galleria imamgini e PDF

This commit is contained in:
Paolo Arena
2019-12-28 02:16:29 +01:00
parent e62cc62d88
commit 523edf557b
2 changed files with 41 additions and 2 deletions

View File

@@ -523,7 +523,6 @@ router.post('/upload_from_other_server/:dir', authenticate, (req, res) => {
}); });
router.post('/upload/:dir', authenticate, (req, res) => { router.post('/upload/:dir', authenticate, (req, res) => {
const dir = req.params.dir; const dir = req.params.dir;
const idapp = req.user.idapp; const idapp = req.user.idapp;
@@ -576,4 +575,32 @@ router.post('/upload/:dir', authenticate, (req, res) => {
}); });
router.delete('/delfile', authenticate, (req, res) => {
const relativefile = req.query.filename;
const idapp = req.user.idapp;
try {
try {
console.log('Delete file ' + relativefile);
// ++ Move in the folder application !
fullpathfile = tools.getdirByIdApp(idapp) + '/' + relativefile;
tools.delete(fullpathfile, (err) => {
if (err) console.log('err', err);
if (err === undefined || err.errno === -2)
res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
});
}catch (e) {
console.log('error', e);
res.status(400).send();
}
} catch (e) {
console.log('Error', e)
}
});
module.exports = router; module.exports = router;

View File

@@ -561,4 +561,16 @@ module.exports = {
} }
}, },
delete(path, callback) {
fs.unlink(path, function (err) {
if (err) {
console.error(err);
callback(err);
return
}
callback();
});
}
}; };