use multer in a function code example Example: multer() var multer = require('multer'); var upload = multer({dest:'uploads/'});