-
-
Save neomadara/b95bd1b61e75b573ab9b to your computer and use it in GitHub Desktop.
Multer uploads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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