javascript - Find out number of files being uploaded with Node before upload -
i'm using node.js , multer upload files. post angular , files sent in body (when @ post request through developer tools see files sent part of request payload).
now i'm introducing paywall app limiting upload of files 3 per month. need complex check see, depending on account, how many files can upload.
the multer api poor handling sort of scenario. need check how many files in request before goes through multer upload. thought must surely available in request, somehow it's not (it within multer).
before multer, req.body {} , req.files undefined. however, when inside multer e.g.
var upload = multer({ //multer settings storage: storage }).any(); upload(req, res, function(err, x) { // req.files contains files can find number req.files.length ... so, how can check how many files in request, without having them going through multer - means uploaded, if user has reached limit, i'll have delete?
Comments
Post a Comment