mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
358 B
14 lines
358 B
'use strict';
|
|
|
|
module.exports = (req, res, next) => {
|
|
res.locals.numFiles = 0;
|
|
if (req.files && req.files.file) {
|
|
if (Array.isArray(req.files.file)) {
|
|
res.locals.numFiles = req.files.file.filter(file => file.size > 0).length;
|
|
} else {
|
|
res.locals.numFiles = req.files.file.size > 0 ? 1 : 0;
|
|
req.files.file = [req.files.file];
|
|
}
|
|
}
|
|
next();
|
|
}
|
|
|