You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I upload a folder, it will only get the actual files within the folder instead of the folder aswell? Is it possible to get the folder and then inside that the files?
router file:
// upload files to user's account
router.post('/upload', ensureAuthenticated, (req, res) => {
if (!req.files || Object.keys(req.files).length === 0) {
return res.status(400).send('No files were uploaded.');
}
// Find where to place the file
const sampleFile = req.files.sampleFile;
console.log(sampleFile);
const path = req.body['path'];
const directPath = path.split('/').slice(2, path.length).join('/');
const newPath = location + req.user._id + '/' + directPath + '/' + sampleFile.name;
// save file
sampleFile.mv(newPath, function(err) {
if (err) return res.status(500).send(err);
res.redirect('/files/' + directPath);
});
});
When I upload a folder, it will only get the actual files within the folder instead of the folder aswell? Is it possible to get the folder and then inside that the files?
router file:
webpage file (.ejs):
The text was updated successfully, but these errors were encountered: