Skip to content

Instantly share code, notes, and snippets.

@neomadara
Forked from kparkov/upload.jade
Created January 25, 2016 02:52
Show Gist options
  • Save neomadara/b95bd1b61e75b573ab9b to your computer and use it in GitHub Desktop.
Save neomadara/b95bd1b61e75b573ab9b to your computer and use it in GitHub Desktop.
Multer uploads
doctype html
html
head
title File uploads
body
form(method="post", action="/file", enctype="multipart/form-data")
input(type="file", name="file")
input(type="submit", value="Upload")
var express = require("express");
var router = express.Router();
var multer = require("multer");
var upload = multer({ dest: "/tmp/" });
router.post('/file', upload.single('file'), (req, res, next) => {
// req.file contains what you need.
});
module.exports = router;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment