Skip to content

Instantly share code, notes, and snippets.

@SiddiqueAhmad
Created February 12, 2022 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SiddiqueAhmad/1693e0a0fc4e0ef1c261fb7e0ba0116f to your computer and use it in GitHub Desktop.
Save SiddiqueAhmad/1693e0a0fc4e0ef1c261fb7e0ba0116f to your computer and use it in GitHub Desktop.
upload file and form field
var express = require('express')
var app = express()
const multer = require('multer')
const upload = multer({ dest: 'uploads/' })
// POST /login gets urlencoded bodies
app.post('/sample', upload.single('uploaded_file'), function (req, res) {
console.log(req.file)
res.send( req.body)
})
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment