LoginSignup
1
2

More than 5 years have passed since last update.

Expressでmultipart/form-dataの値を取得する

Posted at

app.jsのexpress.bodyParserに保存ディレクトリを指定

app.js
app.use(express.bodyParser({uploadDir:'./tmp'}));

あとはpostを受信したい関数で残りのパラメータを取得できます。

app.js
app.post('/items', function(req, res) {
    console.log(req.body);
    console.log(req.files);
    res.send('DONE', 200);
});
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2