Multipart/form-data with arrays

前端 未结 1 1682
伪装坚强ぢ
伪装坚强ぢ 2021-02-06 13:47

I have a simple form:

相关标签:
1条回答
  • 2021-02-06 14:27

    It's probably related to the use of body-parser (especially the urlencoded method) which, by default, works on requests with the media-type application/x-www-form-urlencoded only.

    Your main application module probably has some lines like these:

    const bodyParser = require('body-parser');
    app.use(bodyParser.urlencoded());
    

    I suppose, you could just add the following to have requests of type multipart/form-data parsed as well:

    app.use(bodyParser.urlencoded({
      type: 'multipart/form-data'
    }));
    
    0 讨论(0)
提交回复
热议问题