Skip to content

Instantly share code, notes, and snippets.

@jmas
Created April 28, 2015 12:35
Show Gist options
  • Save jmas/30a3f42b538414566905 to your computer and use it in GitHub Desktop.
Save jmas/30a3f42b538414566905 to your computer and use it in GitHub Desktop.
router.post('/upload',
[ multer({
dest: path.join(__dirname, '..', config.imagesUplodsPath),
rename: function (fieldname, filename) {
return filename.replace(/\W+/g, '-').toLowerCase() + Date.now()
}
}) ],
function(req, res, next) {
res.json({
success: true,
result: {
url: '/image/' + req.files.file.name
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment